Comparison

net/server_event.lua @ 2125:2b4f8a35e41a

net.server_event: Handle and ignore 'wantread' error from receive(), treat as a timeout
author Matthew Wild <mwild1@gmail.com>
date Sun, 22 Nov 2009 04:08:11 +0000
parent 2124:465a7481ab96
child 2126:12669db7ed4a
comparison
equal deleted inserted replaced
2124:465a7481ab96 2125:2b4f8a35e41a
550 debug( "fatal error:", interface.fatalerror ) 550 debug( "fatal error:", interface.fatalerror )
551 interface:_close() 551 interface:_close()
552 interface.eventread = nil 552 interface.eventread = nil
553 return -1 553 return -1
554 end 554 end
555 if err and ( "timeout" ~= err ) then 555 if err and ( err ~= "timeout" and err ~= "wantread" ) then
556 if "wantwrite" == err then -- need to read on write event 556 if "wantwrite" == err then -- need to read on write event
557 if not interface.eventwrite then -- register new write event if needed 557 if not interface.eventwrite then -- register new write event if needed
558 interface.eventwrite = addevent( base, interface.conn, EV_WRITE, interface.writecallback, cfg.WRITE_TIMEOUT ) 558 interface.eventwrite = addevent( base, interface.conn, EV_WRITE, interface.writecallback, cfg.WRITE_TIMEOUT )
559 end 559 end
560 interface.eventreadtimeout = addevent( base, nil, EV_TIMEOUT, 560 interface.eventreadtimeout = addevent( base, nil, EV_TIMEOUT,