Non-blocking SCTP connect [Was: [erlang-patches] SCTP improvements]

Simon Cornish <>
Wed Dec 16 19:27:19 CET 2009

Hi Raimo,

I'm taking this as a separate thread for each topic.

On Wed, Dec 16, 2009 at 4:42 AM, Raimo Niskanen wrote:
> Implement a non-blocking gen_sctp:connect

I think there are plenty of examples in OTP where library functions
return a different type based on the argument(s). But, subjective
comments on style aside (since I have no style :-) I had not
considered that this was changing existing interface semantics in a
service release.

I'm happy to rewrite it as new connect_nowait functions as you
suggest. What's the best way to do this? Amended commit? New commit?
New branch? Maybe Björn has an opinion since he has to do the messy


> lib/kernel/src/inet_sctp.erl: 74/82
>  Comparision Timeout /= 0 should have been Timeout =/= 0
>  just to be certain...
>  To compare Timeout =/= 0 is unfortunately also wrong since
>  time may have elapsed since inet:start_timer/1 was
>  called and inet:timeout/1 may return 0 when the original
>  Timeout actually was nonzero.
> And, furthermore; having gen_sctp:connect/4,5 to return a
> different type for some value (i.e 0) of an argument
> (i.e Timeout) is considered ugly. And introducing such
> a change in a service release is out of the question.
> Therefore; can you rewrite your patch to introduce a new
> function gen_sctp:connect_nowait/4 that does exactly
> what your gen_sctp:connect(S, Add, Port, Opts, 0) did?
> There will be some code duplication, but you can maybe
> also avoid creating a timer alltogether and perhaps
> use a special value (e.g 0) to inet_sctp:connect/5,
> last argument, to not have to duplicate everything.
> inet_sctp is a non-public interface so it can be altered.
> Doing it this way also avoids fixing inet6_sctp.erl.

More information about the erlang-patches mailing list