Software /
code /
prosody
Comparison
net/server_select.lua @ 6543:01cd51777abb
net.server_select: Remove unused code
author | daurnimator <quae@daurnimator.com> |
---|---|
date | Mon, 19 Jan 2015 14:09:13 -0500 |
parent | 6542:32c84e1f706d |
child | 6791:e813e8cf6046 |
comparison
equal
deleted
inserted
replaced
6542:32c84e1f706d | 6543:01cd51777abb |
---|---|
29 local tonumber = use "tonumber" | 29 local tonumber = use "tonumber" |
30 local tostring = use "tostring" | 30 local tostring = use "tostring" |
31 | 31 |
32 --// lua libs //-- | 32 --// lua libs //-- |
33 | 33 |
34 local os = use "os" | |
35 local table = use "table" | 34 local table = use "table" |
36 local string = use "string" | 35 local string = use "string" |
37 local coroutine = use "coroutine" | 36 local coroutine = use "coroutine" |
38 | 37 |
39 --// lua lib methods //-- | 38 --// lua lib methods //-- |
285 | 284 |
286 local bufferqueue = { } -- buffer array | 285 local bufferqueue = { } -- buffer array |
287 local bufferqueuelen = 0 -- end of buffer array | 286 local bufferqueuelen = 0 -- end of buffer array |
288 | 287 |
289 local toclose | 288 local toclose |
290 local fatalerror | |
291 local needtls | 289 local needtls |
292 | 290 |
293 local bufferlen = 0 | 291 local bufferlen = 0 |
294 | 292 |
295 local noread = false | 293 local noread = false |
497 _readtimes[ handler ] = _currenttime | 495 _readtimes[ handler ] = _currenttime |
498 --out_put( "server.lua: read data '", buffer:gsub("[^%w%p ]", "."), "', error: ", err ) | 496 --out_put( "server.lua: read data '", buffer:gsub("[^%w%p ]", "."), "', error: ", err ) |
499 return dispatch( handler, buffer, err ) | 497 return dispatch( handler, buffer, err ) |
500 else -- connections was closed or fatal error | 498 else -- connections was closed or fatal error |
501 out_put( "server.lua: client ", tostring(ip), ":", tostring(clientport), " read error: ", tostring(err) ) | 499 out_put( "server.lua: client ", tostring(ip), ":", tostring(clientport), " read error: ", tostring(err) ) |
502 fatalerror = true | |
503 _ = handler and handler:force_close( err ) | 500 _ = handler and handler:force_close( err ) |
504 return false | 501 return false |
505 end | 502 end |
506 end | 503 end |
507 local _sendbuffer = function( ) -- this function sends data | 504 local _sendbuffer = function( ) -- this function sends data |
537 bufferlen = bufferlen - byte | 534 bufferlen = bufferlen - byte |
538 _writetimes[ handler ] = _currenttime | 535 _writetimes[ handler ] = _currenttime |
539 return true | 536 return true |
540 else -- connection was closed during sending or fatal error | 537 else -- connection was closed during sending or fatal error |
541 out_put( "server.lua: client ", tostring(ip), ":", tostring(clientport), " write error: ", tostring(err) ) | 538 out_put( "server.lua: client ", tostring(ip), ":", tostring(clientport), " write error: ", tostring(err) ) |
542 fatalerror = true | |
543 _ = handler and handler:force_close( err ) | 539 _ = handler and handler:force_close( err ) |
544 return false | 540 return false |
545 end | 541 end |
546 end | 542 end |
547 | 543 |
1009 else | 1005 else |
1010 return nil, err | 1006 return nil, err |
1011 end | 1007 end |
1012 end | 1008 end |
1013 | 1009 |
1014 --// EXPERIMENTAL //-- | |
1015 | |
1016 ----------------------------------// BEGIN //-- | 1010 ----------------------------------// BEGIN //-- |
1017 | 1011 |
1018 use "setmetatable" ( _socketlist, { __mode = "k" } ) | 1012 use "setmetatable" ( _socketlist, { __mode = "k" } ) |
1019 use "setmetatable" ( _readtimes, { __mode = "k" } ) | 1013 use "setmetatable" ( _readtimes, { __mode = "k" } ) |
1020 use "setmetatable" ( _writetimes, { __mode = "k" } ) | 1014 use "setmetatable" ( _writetimes, { __mode = "k" } ) |