Comparison

net/server_event.lua @ 2303:ecbd68fc46db

net.server_event: Port fix in 2dc9bbf25447 to libevent-based backend
author Matthew Wild <mwild1@gmail.com>
date Thu, 03 Dec 2009 02:30:09 +0000
parent 2240:373e3fd8b862
child 2318:a831de056de3
comparison
equal deleted inserted replaced
2302:2dc9bbf25447 2303:ecbd68fc46db
570 debug( "fatal error:", interface.fatalerror ) 570 debug( "fatal error:", interface.fatalerror )
571 interface:_close() 571 interface:_close()
572 interface.eventread = nil 572 interface.eventread = nil
573 return -1 573 return -1
574 end 574 end
575 interface.onincoming( interface, buffer, err ) -- send new data to listener
575 if err and ( err ~= "timeout" and err ~= "wantread" ) then 576 if err and ( err ~= "timeout" and err ~= "wantread" ) then
576 if "wantwrite" == err then -- need to read on write event 577 if "wantwrite" == err then -- need to read on write event
577 if not interface.eventwrite then -- register new write event if needed 578 if not interface.eventwrite then -- register new write event if needed
578 interface.eventwrite = addevent( base, interface.conn, EV_WRITE, interface.writecallback, cfg.WRITE_TIMEOUT ) 579 interface.eventwrite = addevent( base, interface.conn, EV_WRITE, interface.writecallback, cfg.WRITE_TIMEOUT )
579 end 580 end
590 interface:_close() 591 interface:_close()
591 interface.eventread = nil 592 interface.eventread = nil
592 return -1 593 return -1
593 end 594 end
594 end 595 end
595 interface.onincoming( interface, buffer, err ) -- send new data to listener
596 return EV_READ, cfg.READ_TIMEOUT 596 return EV_READ, cfg.READ_TIMEOUT
597 end 597 end
598 end 598 end
599 599
600 client:settimeout( 0 ) -- set non blocking 600 client:settimeout( 0 ) -- set non blocking