Mercurial > prosody-hg
comparison net/server_select.lua @ 7736:5a07fe977002
net.server_select: Prevent writes after a handler is closed (fixes #783 I hope)
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Tue, 22 Nov 2016 15:28:24 +0100 |
| parents | 5a71aaa2c542 |
| children | 0647b821e00a |
comparison
equal
deleted
inserted
replaced
| 7713:003ee2be2635 | 7736:5a07fe977002 |
|---|---|
| 413 handler.clientport = function( ) | 413 handler.clientport = function( ) |
| 414 return clientport | 414 return clientport |
| 415 end | 415 end |
| 416 handler.port = handler.clientport -- COMPAT server_event | 416 handler.port = handler.clientport -- COMPAT server_event |
| 417 local write = function( self, data ) | 417 local write = function( self, data ) |
| 418 if not handler then return false end | |
| 418 bufferlen = bufferlen + #data | 419 bufferlen = bufferlen + #data |
| 419 if bufferlen > maxsendlen then | 420 if bufferlen > maxsendlen then |
| 420 _closelist[ handler ] = "send buffer exceeded" -- cannot close the client at the moment, have to wait to the end of the cycle | 421 _closelist[ handler ] = "send buffer exceeded" -- cannot close the client at the moment, have to wait to the end of the cycle |
| 421 handler.write = idfalse -- dont write anymore | 422 handler.write = idfalse -- dont write anymore |
| 422 return false | 423 return false |
