Software /
code /
prosody
Changeset
5337:c22dd451487f
net.server_select: Use # operator instead of string.len
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 01 Mar 2013 11:11:05 +0100 |
parents | 5336:eeb24f1e2c84 |
children | 5338:3df649ec43ea |
files | net/server_select.lua |
diffstat | 1 files changed, 2 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/net/server_select.lua Tue Feb 26 23:57:44 2013 +0500 +++ b/net/server_select.lua Fri Mar 01 11:11:05 2013 +0100 @@ -47,7 +47,6 @@ 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 @@ 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 @@ 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