On Wed, Dec 9, 2009 at 3:45 PM, Christian Gan <christian.gan at librestream.com> wrote: > > On Wed, Dec 9, 2009 at 7:26 AM, Benny Prijono <bennylp at teluu.com> wrote: >> Aha! We also found the same problem when we implemented (the new) TLS >> on 1.5, and I've forgotten about SO_UPDATE_ACCEPT_CONTEXT back then, >> so we solved it differently, I think. Upon checking the source code >> again, it looks like we do call setsockopt(SO_UPDATE_ACCEPT_CONTEXT), >> but it seems that we call it at wrong time, in pj_ioqueue_accept() >> while it should have been in ioqueue_on_accept_complete()? > > We just ended up moving the setsockopt for SO_UPDATE_ACCEPT_CONTEXT into > poll_iocp() after the call to ioqueue_on_accept_complete() but before > calling the callback in key->cb.on_accept_complete(). ?It worked for us > but do you think it would be better to call it under > pj_ioqueue_accept()? > I think it's probably best to call it inside ioqueue_on_accept_complete(), since there is an alternate flow to accept a new connection, i.e. if there is an incoming connection already available, AcceptEx() will return this socket immediately hence we will not see poll_iocp() flow. I think that's what I'll do for the fix. Thanks for confirming this. Cheers Benny