D 2009-07-11T04:26:07
J icomment The\scrucial\srequirement\sfor\sthis\scrash\sis\sthat\swe\suse\sgets\sand\snot\sread\sand\sthat\san\serror\soccurs\sduring\sthe\sunderlying\sread\sfrom\sthe\schannel.\sProvided\swe\sadditionally\sfail\sto\sunhook\sthe\sfileevents\swe\sget\sa\scrash\scaused\sby\sa\sfileevent\sfrom\sthe\swindows\ssocket\scode\strying\sto\sprocess\san\sevent\son\sthe\schannel\sstructure\sthat\shas\salready\sbeen\sdeleted.\nWe\scan\sgenerate\sthe\schannel\serror\susing\sa\smismatched\scompress/decompress\spair\sso\sthat\sthe\sread/gets\scall\swill\serror.\sThis\smatched\swith\sa\schannel\sevent\shandler\slike:\nproc\sRead\s{type\schan}\s{\n\s\s\s\s#set\sdata\s[read\s$chan]\n\s\s\s\sif\s{[gets\s$chan\sline]\s<\s0}\s{\n\s\s\s\s\s\s\s\sputs\s"error?"\n\s\s\s\s\s\s\s\s#chan\sevent\s$chan\s{}\n\s\s\s\s\s\s\s\sclose\s$chan\n\s\s\s\s\s\s\s\sreturn\n\s\s\s\s}\n\s\s\s\sputs\s"Read\s$type\s[string\slength\s$data]"\n\s\s\s\sif\s{[eof\s$chan]}\s{\n\s\s\s\s\s\s\s\sputs\s"Eof\s$type\s$chan"\n\s\s\s\s\s\s\s\sclose\s$sock\n\s\s\s\s}\n}\nwill\scrash.\sIf\swe\suse\sread\sit\sisssues\san\serror\smessage.\sIf\swe\sunset\sthe\sevent\shandler\sit\swill\sbe\sok\stoo.\n
J login patthoyts
J mimetype text/plain
J username patthoyts
K 2818131fffffffffffffffffffffffffffffffff
U patthoyts
Z 7019eca60c30e316c4ec5b467855db30