aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2013-03-01 11:11:05 +0100
committerKim Alvefur <zash@zash.se>2013-03-01 11:11:05 +0100
commite89b805d067713044d8362b952342048b2d7267c (patch)
tree0017c24837b44aa49e5d01a5346762883e632abb /net
parent9e06c3bd5cc3119333f211115513e8ae6b1cc8c6 (diff)
downloadprosody-e89b805d067713044d8362b952342048b2d7267c.tar.gz
prosody-e89b805d067713044d8362b952342048b2d7267c.zip
net.server_select: Use # operator instead of string.len
Diffstat (limited to 'net')
-rw-r--r--net/server_select.lua5
1 files changed, 2 insertions, 3 deletions
diff --git a/net/server_select.lua b/net/server_select.lua
index 250438c3..4d959a26 100644
--- a/net/server_select.lua
+++ b/net/server_select.lua
@@ -47,7 +47,6 @@ local os_difftime = os.difftime
local math_min = math.min
local math_huge = math.huge
local table_concat = table.concat
-local string_len = string.len
local string_sub = string.sub
local coroutine_wrap = coroutine.wrap
local coroutine_yield = coroutine.yield
@@ -406,7 +405,7 @@ wrapconnection = function( server, listeners, socket, ip, serverport, clientport
return clientport
end
local write = function( self, data )
- bufferlen = bufferlen + string_len( data )
+ bufferlen = bufferlen + #data
if bufferlen > maxsendlen then
_closelist[ handler ] = "send buffer exceeded" -- cannot close the client at the moment, have to wait to the end of the cycle
handler.write = idfalse -- dont write anymore
@@ -488,7 +487,7 @@ wrapconnection = function( server, listeners, socket, ip, serverport, clientport
local buffer, err, part = receive( socket, pattern ) -- receive buffer with "pattern"
if not err or (err == "wantread" or err == "timeout") then -- received something
local buffer = buffer or part or ""
- local len = string_len( buffer )
+ local len = #buffer
if len > maxreadlen then
handler:close( "receive buffer exceeded" )
return false