Software /
code /
prosody
Comparison
net/server_event.lua @ 3002:d1f864ed44c0
net.server_select, net.server_event: Support for ondrain listener callback for when send buffer is empty
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 05 May 2010 15:24:24 +0100 |
parent | 3001:fa00c6f563b4 |
child | 3003:48871a549b4c |
comparison
equal
deleted
inserted
replaced
3001:fa00c6f563b4 | 3002:d1f864ed44c0 |
---|---|
463 end | 463 end |
464 function interface_mt:ondisconnect() | 464 function interface_mt:ondisconnect() |
465 end | 465 end |
466 function interface_mt:ontimeout() | 466 function interface_mt:ontimeout() |
467 end | 467 end |
468 function interface_mt:ondrain() | |
469 end | |
468 function interface_mt:onstatus() | 470 function interface_mt:onstatus() |
469 debug("server.lua: Dummy onstatus()") | 471 debug("server.lua: Dummy onstatus()") |
470 end | 472 end |
471 end | 473 end |
472 | 474 |
543 local succ, err, byte = interface.conn:send( interface.writebuffer, 1, interface.writebufferlen ) | 545 local succ, err, byte = interface.conn:send( interface.writebuffer, 1, interface.writebufferlen ) |
544 --vdebug( "write data:", interface.writebuffer, "error:", err, "part:", byte ) | 546 --vdebug( "write data:", interface.writebuffer, "error:", err, "part:", byte ) |
545 if succ then -- writing succesful | 547 if succ then -- writing succesful |
546 interface.writebuffer = "" | 548 interface.writebuffer = "" |
547 interface.writebufferlen = 0 | 549 interface.writebufferlen = 0 |
550 interface:ondrain(); | |
548 if interface.fatalerror then | 551 if interface.fatalerror then |
549 debug "closing client after writing" | 552 debug "closing client after writing" |
550 interface:_close() -- close interface if needed | 553 interface:_close() -- close interface if needed |
551 elseif interface.startsslcallback then -- start ssl connection if needed | 554 elseif interface.startsslcallback then -- start ssl connection if needed |
552 debug "starting ssl handshake after writing" | 555 debug "starting ssl handshake after writing" |