According to Stevens UNIX Network Programming and various other sources, the correct handling for non-blocking connect() is: - when the initial connect() return -1/EINPROGRESS polling the socket for *writeability* - in the poll handler call getsocktopt() with SO_ERROR to get the finished connect() return value Simply calling connect() a second time without error checking is probably wrong and not portable. For a successfull connect() Linux returns 0, but Solaris will return EISCONN: 24254: 0.0336 0.0002 connect(4, 0xFEFFECAC, 16, SOV_DEFAULT) Err#150 EINPROGRESS 24254: AF_INET name = 10.10.10.143 port = 1024 24254: 0.0349 0.0001 port_associate(3, 4, 0x00000004, 0x0000001D,0x080648A8) = 0 24254: 0.0495 0.0146 port_getn(3, 0xFEFFEB50, 1, 1, 0xFEFFEB60) = 1 [0] 24254: 0.0497 0.0002 connect(4, 0x080646E4, 16, SOV_DEFAULT) Err#133 EISCONN 24254: AF_INET name = 10.10.10.143 port = 1024 Patch to folllow.
Created attachment 11511 [details] Patch for master
Created attachment 11512 [details] Patch for master
Created attachment 11513 [details] Fixed version - port should be uint16_t.
Created attachment 11515 [details] git-am fix for 4.3.next. Cherry-picked from master.
Created attachment 11516 [details] git-am fix for 4.2.next. Cherry-picked from master (minus test, which doesn't apply cleanly - not needed for code fix anyway).
Comment on attachment 11516 [details] git-am fix for 4.2.next. We need the fix for the memset() parameter bug Andrew discovered, either squashed or appended. Will follow-up with an updated patchset for 4.2 and 4.3.
Comment on attachment 11515 [details] git-am fix for 4.3.next. We need the fix for the memset() parameter bug Andrew discovered, either squashed or appended. Will follow-up with an updated patchset for 4.2 and 4.3.
Sorry for missing the memset problem - compiled without warnings so I didn't spot it. Cheers, Jeremy.
Created attachment 11521 [details] git-am fix for 4.3.next. Cherry-picked from master + squashed memset fix.
Created attachment 11522 [details] git-am fix for 4.2.next. Contains squash of memset fix.
Reassigning to Karolin for inclusion in 4.2 and 4.3. Thanks!
(In reply to Ralph Böhme from comment #11) Pushed to autobuild-v4[3|2]-test.
Pushed to v4-2-test and v4-3-test. Closing out bug report. Thanks!