[haiku-bugs] Re: [Haiku] #2963: select() doesn't wait after non-blocking connect()

  • From: "pulkomandy" <trac@xxxxxxxxxxxx>
  • Date: Thu, 09 Jan 2014 17:21:33 -0000

#2963: select() doesn't wait after non-blocking connect()
--------------------------------------+---------------------------
   Reporter:  bonefish                |      Owner:  axeld
       Type:  bug                     |     Status:  new
   Priority:  normal                  |  Milestone:  R1
  Component:  Network & Internet/TCP  |    Version:  R1/pre-alpha1
 Resolution:                          |   Keywords:
 Blocked By:                          |   Blocking:
Has a Patch:  0                       |   Platform:  All
--------------------------------------+---------------------------

Comment (by pulkomandy):

 I had a look at improving this today.

 I modified TCPEndPoint::SendAvailable() to return 0 when the fState is
 SYNCHRONIZE_SENT. This gets select() to properly lock, waiting for the
 connection to establish.

 However, the next problem is it doesn't get unlocked when the connection
 actually happens. I also tried closing the socket from another thread
 (this is what I'm after), and this also didn't work. So, the select stays
 locked forever (or until timeout).

 I tried adding my socket to the read set for the select call, but this
 didn't help. The "error" case is not implemented, as far as I could tell.

 Also, it's easier to test this by using a non-existing IP to connect to.
 You can easily tell apart the cases where it works as expected (long
 timeout for the select) from those where it doesn't (selectreturs very
 fast).

 I also tried making the socket blocking again after calling connect, but
 select still doesn't block with the current code. And still blocks
 infinitely with my modified one.

 Any hint as to what to do next?

--
Ticket URL: <http://dev.haiku-os.org/ticket/2963#comment:3>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: