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

Simon Cornish <>
Tue Dec 22 07:57:22 CET 2009

Just in time for Christmas, a non-blocking SCTP connect.

git fetch git://github.com/dotsimon/otp.git sctp_connect_nowait

I decided to name the functions connect_init to better reflect the
behaviour since there can actually be some waiting if the peer address
needs resolving.

The commit comment hopefully contains enough information to update the
documentation. I did not want to mess with the XML directly since
there is no way to build and see it looks ok.


ps. I see that unfortunately somewhere between GitX, git and github
the line-wrapping in my commit comment has been horribly mangled. I
think it's just readable!

On Wed, Dec 16, 2009 at 10:27 AM, Simon Cornish
zl9d97p02-at-sneakemail.com |erlang-mail/gmail|
<> wrote:
> Hi Raimo,
> I'm taking this as a separate thread for each topic.
> On Wed, Dec 16, 2009 at 4:42 AM, Raimo Niskanen
> raimo+erlang-patches-at-erix.ericsson.se wrote:
> [...]
>> http://github.com/erlang/otp/commit/92f3ceea0fa51df308f6f2689ff82857b6442c30
>> 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
> part...
> Regards,
>  Simon
>> 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.
> ________________________________________________________________
> erlang-patches mailing list. See http://www.erlang.org/faq.html
> erlang-patches (at) erlang.org

More information about the erlang-patches mailing list