- local buffer = table_concat( bufferqueue, "", 1, bufferqueuelen )\r
- local succ, err, byte = send( socket, buffer, 1, bufferlen )\r
- local count = ( succ or byte or 0 ) * STAT_UNIT\r
- sendtraffic = sendtraffic + count\r
- _sendtraffic = _sendtraffic + count\r
- _ = _cleanqueue and clean( bufferqueue )\r
- --out_put( "server.lua: sended '", buffer, "', bytes: ", tostring(succ), ", error: ", tostring(err), ", part: ", tostring(byte), ", to: ", tostring(ip), ":", tostring(clientport) )\r
+ local succ, err, byte, buffer, count;\r
+ local count;\r
+ if socket then\r
+ buffer = table_concat( bufferqueue, "", 1, bufferqueuelen )\r
+ succ, err, byte = send( socket, buffer, 1, bufferlen )\r
+ count = ( succ or byte or 0 ) * STAT_UNIT\r
+ sendtraffic = sendtraffic + count\r
+ _sendtraffic = _sendtraffic + count\r
+ _ = _cleanqueue and clean( bufferqueue )\r
+ --out_put( "server.lua: sended '", buffer, "', bytes: ", tostring(succ), ", error: ", tostring(err), ", part: ", tostring(byte), ", to: ", tostring(ip), ":", tostring(clientport) )\r
+ else\r
+ succ, err, count = false, "closed", 0;\r
+ end\r