: <i>socket -async leaves the socket non-blocking when the connect succeeds at once</i> plus 8 other changes
by
.
D 2026-10-13T12:23:54.349
J assignee jan.nijtmans
J closedate 2461327.0166012617
J closer jan.nijtmans
J comment On\sillumos\s(OpenIndiana),\sa\snon-blocking\s<code>connect()</code>\sto\sa\slocal\slistener\r\nsucceeds\sat\sonce\sinstead\sof\sreturning\sEINPROGRESS;\son\sDragonFly\sthis\shappens\sfor\sIPv6\r\n(<code>::1</code>).\s<code>TcpConnect()</code>\smakes\sthe\ssocket\snon-blocking\sfor\r\n<code>socket\s-async</code>\sbut\srestores\sthe\sblocking\smode\sonly\swhen\sthe\sconnect\r\nfinishes\sin\sthe\sbackground.\sSo\safter\ssuch\san\simmediate\sconnect\sthe\ssocket\sstays\r\nnon-blocking\swhile\sthe\schannel\sis\sblocking,\sand\sa\sblocking\s<code>gets</code>\sreturns\r\nan\sempty\sstring\sat\sonce.\sThis\sfails\ssocket-14.7.0\sand\s14.7.1\son\sillumos\sand\r\nsocket-14.7.1\son\sDragonFly.\r\n\r\nThis\sis\sa\sregression\sof\s[219061]\s(HP-UX,\sfixed\sin\s8.3.1\sby\sresetting\sthe\ssocket\sto\r\nblocking\smode\swhen\sthe\sconnect\ssucceeds\sat\sonce).\sSince\sthe\s2011\srework\sthe\r\nblocking\smode,\scached\ssince\s[3401422],\sis\srestored\sonly\safter\sa\sconnect\sfinishing\sin\r\nthe\sbackground;\s[3428753]\sfixed\sonly\sthe\sflag\sfor\sconnections\scompleting\sat\sonce.\r\n\r\nProposed\sfix\sin\sbranch\s[/timeline?r=unix-async-connect-immediate-success|unix-async-connect-immediate-success].
J icomment Fixed\sin\s[6d02d5f8a6|trunk],\score-9-0-branch\sand\score-8-6-branch
J login jan.nijtmans
J mimetype text/x-fossil-wiki
J resolution Fixed
J status Closed
K d22dc7e9ca3577d84c76cf0091d9db9eb9245da2
U jan.nijtmans
Z 38f2012c81540b05e07cc0d340552948