comparison net/server.lua @ 1886:d19c0a21bfb6

net.server: Small logging improvements
author Matthew Wild <mwild1@gmail.com>
date Sun, 04 Oct 2009 16:05:11 +0100
parents 1fde15a415e6
children 64538c620450
comparison
equal deleted inserted replaced
1885:1fde15a415e6 1886:d19c0a21bfb6
479 end 479 end
480 local count = len * STAT_UNIT 480 local count = len * STAT_UNIT
481 readtraffic = readtraffic + count 481 readtraffic = readtraffic + count
482 _readtraffic = _readtraffic + count 482 _readtraffic = _readtraffic + count
483 _readtimes[ handler ] = _currenttime 483 _readtimes[ handler ] = _currenttime
484 --out_put( "server.lua: read data '", buffer, "', error: ", err ) 484 --out_put( "server.lua: read data '", buffer:gsub("[^%w%p ]", "."), "', error: ", err )
485 return dispatch( handler, buffer, err ) 485 return dispatch( handler, buffer, err )
486 else -- connections was closed or fatal error 486 else -- connections was closed or fatal error
487 out_put( "server.lua: client ", tostring(ip), ":", tostring(clientport), " error: ", tostring(err) ) 487 out_put( "server.lua: client ", tostring(ip), ":", tostring(clientport), " read error: ", tostring(err) )
488 fatalerror = true 488 fatalerror = true
489 disconnect( handler, err ) 489 disconnect( handler, err )
490 _ = handler and handler.close( ) 490 _ = handler and handler.close( )
491 return false 491 return false
492 end 492 end
519 bufferqueuelen = 1 519 bufferqueuelen = 1
520 bufferlen = bufferlen - byte 520 bufferlen = bufferlen - byte
521 _writetimes[ handler ] = _currenttime 521 _writetimes[ handler ] = _currenttime
522 return true 522 return true
523 else -- connection was closed during sending or fatal error 523 else -- connection was closed during sending or fatal error
524 out_put( "server.lua: client ", tostring(ip), ":", tostring(clientport), " error: ", tostring(err) ) 524 out_put( "server.lua: client ", tostring(ip), ":", tostring(clientport), " write error: ", tostring(err) )
525 fatalerror = true 525 fatalerror = true
526 disconnect( handler, err ) 526 disconnect( handler, err )
527 _ = handler and handler.close( ) 527 _ = handler and handler.close( )
528 return false 528 return false
529 end 529 end