Software /
code /
prosody
Changeset
999:c088139d8f05
net.server: Fix potential nil handler usage
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 17 Apr 2009 16:11:11 +0100 |
parents | 997:c81b6141d693 |
children | 1000:a73715a9267f |
files | net/server.lua |
diffstat | 1 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/net/server.lua Sun Apr 12 19:05:55 2009 +0100 +++ b/net/server.lua Fri Apr 17 16:11:11 2009 +0100 @@ -325,7 +325,9 @@ if not ( forced or fatalerror ) then handler.sendbuffer( ) if bufferqueuelen ~= 0 then -- try again... - handler.write = nil -- ... but no further writing allowed + if handler then + handler.write = nil -- ... but no further writing allowed + end toclose = true return false end @@ -337,9 +339,11 @@ socket:close( ) _sendlistlen = removesocket( _sendlist, socket, _sendlistlen ) _socketlist[ socket ] = nil - _writetimes[ handler ] = nil - _closelist[ handler ] = nil - handler = nil + if handler then + _writetimes[ handler ] = nil + _closelist[ handler ] = nil + handler = nil + end socket = nil mem_free( ) if server then