Skip to content
Tcl Source Code Artifact [0812aa6d21]
Login

Artifact [0812aa6d21]

Artifact 0812aa6d210cf4dd91e4c1b2bd584ec6e8e08ed2904b4363366d38875021dde5:

Ticket change [0812aa6d21] - Ticket [de232b49f26da1c1|de232b49f2] <i>write-only nonblocking refchan and Tcl internal buffers</i> status still Open with 3 other changes by pooryorick on 2024-03-29 21:51:53.
D 2024-03-29T21:51:53.024
J icomment The\srefchan\sissue\sdescribed\shere\sis\sfar\smore\sserious\sthan\sthe\sfailure\sof\r\ntest\ssocket-14.11.0,\sbecause\sin\sa\ssituation\slike\sthe\sone\sillustrated\sby\r\nthat\stest,\sat\sleast\sthe\sscript\sbecomes\saware\sthat\sthe\schannel\sis\sbroken,\r\nand\shas\sthe\sopportunity\sto\srespond\ssomehow.\s\sIn\scontrast,\sany\sscript\r\nthat\sfalls\svictim\sto\sthe\srefchan\sissue\sdescribed\sin\sthis\sticket,\sit\shas\r\nno\srecourse,\sand\ssimply\sfails\ssilently\sand\sirretrievably.\r\n\r\nThere\sare\smany\sways\sin\swhich\schannel\scan\sbecome\sbroken,\sand\sa\ssocket\r\nfailure\sto\sconnect\sis\sfor\spractical\spurposes\snot\smuch\sdifferent\sthan\sany\r\nof\sthose\sother\sfailure\smodes.\s\sIn\smy\sopinion,\s"async"\sshould\smean\sasync\r\nfrom\sstart\sto\sfinish,\sand\sthe\sscript\sitself\scan\sdecide\show\sto\shandle\sthe\r\nvarious\spossible\sfailures\sin\san\sasynchronous\sway.\s\r\n\r\nIn\sthe\smeantime\sthere\sare\sways\sto\savoid\sthe\sproblem\sAshok\sillustrated\r\nwith\stwapi\sin\s[080f846fd5].\s\sFor\sone\sthing,\sthe\sexample\sis\sa\slittle\r\nstrange:\r\n\r\n\s\s<code><verbatim>\r\n\s\s\s\s\s\sset\sso\s[twapi::tls_socket\s-async\swww.example.com\s443]\r\n\s\s\s\s\s\sfconfigure\s$so\s-blocking\s0\r\n\s\s</verbatim></code>\r\n\r\nThe\ssocket\sis\sopened\sin\sasynchronous\smode,\sbut\sthe\sfor\ssome\sreason\sit\sis\r\nstill\snecessary\sto\sset\sthe\sblocking\smode\sof\sthe\sresulting\schannel\sto\s0.\r\nWhy\sthe\sredundancy?\s\sI\swould\sguess\sthat\sif\sthe\s"-async"\sargument\swere\r\nremoved,\sthen\stwapi\swould\swait\sfor\sthe\sconnection\sto\scomplete,\sand\sthen\r\nthe\srest\sof\sthe\scode\swould\scontinue\sto\sfunction\sasynchronously:\r\n\r\n\s\s<code><verbatim>\r\n\s\s\s\s\s\sset\sso\s[twapi::tls_socket\swww.example.com\s443]\r\n\s\s\s\s\s\sfconfigure\s$so\s-blocking\s0\r\n\s\s</verbatim></code>\r\n\r\nThe\ssame\sis\strue\sfor\ssocket-14.11.0.\s\sThe\sdocumentation\sfor\sthe\s"-async"\r\noption\sto\s[socket]\shas\slong\sdescribed\sthe\spossibility:\s\s"This\smeans\sthat\r\nthe\ssocket\swill\sbe\screated\simmediately\sbut\smay\snot\syet\sbe\sconnected\sto\r\nthe\sserver,\swhen\sthe\scall\sto\ssocket\sreturns."\r\n\r\nSo\seven\sjust\sfollowing\sthe\sdocumentation\swill\savoid\sthe\sissue\sAshok\shas\r\nraised.\s\sI\swould\snot\srevert\sthis\sfix.\s\sThere\smay\swell\sbe\sa\smore\r\nsatisfying\sfix,\sand\sif\sit\sis\sfound,\sit\scan\sof\scourse\sreplace\sthis\sone.
J login pooryorick
J mimetype text/x-fossil-wiki
K de232b49f26da1c18e07513d4c7caa203cd27910
U pooryorick
Z 7e0f9a51cdc2b74f202ed7733fe50f4a