Remove debug logs
This commit is contained in:
parent
264df430ad
commit
a6a2d19ff8
@ -1074,7 +1074,6 @@ function client_mt:_apply_network_timeout()
|
|||||||
-- replace connection recv_func with coroutine-based version
|
-- replace connection recv_func with coroutine-based version
|
||||||
local sync_recv_func = conn.recv_func
|
local sync_recv_func = conn.recv_func
|
||||||
conn.recv_func = function(totalSize, ...)
|
conn.recv_func = function(totalSize, ...)
|
||||||
print("Args: ("..(1+#{...})..")", totalSize, ...)
|
|
||||||
while true do
|
while true do
|
||||||
local allData = ""
|
local allData = ""
|
||||||
while true do
|
while true do
|
||||||
@ -1178,7 +1177,6 @@ function client_mt:_receive_packet()
|
|||||||
return false, "network connection is not opened"
|
return false, "network connection is not opened"
|
||||||
end
|
end
|
||||||
-- parse packet
|
-- parse packet
|
||||||
print("Calling ", conn.recv_func)
|
|
||||||
local packet, err = self._parse_packet(conn.recv_func)
|
local packet, err = self._parse_packet(conn.recv_func)
|
||||||
if not packet then
|
if not packet then
|
||||||
return false, err
|
return false, err
|
||||||
|
@ -25,12 +25,7 @@ end
|
|||||||
-- Send data to network connection
|
-- Send data to network connection
|
||||||
function luasocket.send(conn, data, i, j)
|
function luasocket.send(conn, data, i, j)
|
||||||
conn.sock:settimeout(nil, "t")
|
conn.sock:settimeout(nil, "t")
|
||||||
print("Sending bytes ", #data, i, j)
|
|
||||||
local ok, err = conn.sock:send(data, i, j)
|
local ok, err = conn.sock:send(data, i, j)
|
||||||
if err == "timeout" then
|
|
||||||
print("Oops, got timeout")
|
|
||||||
print(debug.traceback())
|
|
||||||
end
|
|
||||||
conn.sock:settimeout(conn.timeout, "t")
|
conn.sock:settimeout(conn.timeout, "t")
|
||||||
-- print(" luasocket.send:", ok, err, require("mqtt.tools").hex(data))
|
-- print(" luasocket.send:", ok, err, require("mqtt.tools").hex(data))
|
||||||
return ok, err
|
return ok, err
|
||||||
@ -39,25 +34,16 @@ end
|
|||||||
-- Receive given amount of data from network connection
|
-- Receive given amount of data from network connection
|
||||||
function luasocket.receive(conn, size)
|
function luasocket.receive(conn, size)
|
||||||
local ok, err = conn.sock:receive(size)
|
local ok, err = conn.sock:receive(size)
|
||||||
if ok then
|
--if ok then
|
||||||
if #ok ~= size then
|
-- print(" luasocket.receive good:", size, #ok, require("mqtt.tools").hex(ok))
|
||||||
assert(false, "bad size")
|
--elseif err ~= "timeout" then
|
||||||
end
|
-- print(" luasocket.receive fail:", ok, err)
|
||||||
if #ok > 100 then
|
--end
|
||||||
print(" luasocket.receive good:", size, #ok, "(long)")
|
|
||||||
else
|
|
||||||
--print(debug.traceback())
|
|
||||||
print(" luasocket.receive good:", size, #ok, require("mqtt.tools").hex(ok))
|
|
||||||
end
|
|
||||||
elseif err ~= "timeout" then
|
|
||||||
print(" luasocket.receive fail:", ok, err)
|
|
||||||
end
|
|
||||||
return ok, err
|
return ok, err
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Set connection's socket to non-blocking mode and set a timeout for it
|
-- Set connection's socket to non-blocking mode and set a timeout for it
|
||||||
function luasocket.settimeout(conn, timeout)
|
function luasocket.settimeout(conn, timeout)
|
||||||
print("Setting timeout to " .. timeout)
|
|
||||||
conn.timeout = timeout
|
conn.timeout = timeout
|
||||||
conn.sock:settimeout(timeout, "t")
|
conn.sock:settimeout(timeout, "t")
|
||||||
end
|
end
|
||||||
|
@ -490,16 +490,12 @@ function protocol.start_parse_packet(read_func)
|
|||||||
len, err = parse_var_length(read_func)
|
len, err = parse_var_length(read_func)
|
||||||
if not len then
|
if not len then
|
||||||
return false, "failed to parse remaining length: "..err
|
return false, "failed to parse remaining length: "..err
|
||||||
else
|
|
||||||
print("Variable length is: " .. len)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- create packet parser instance (aka input)
|
-- create packet parser instance (aka input)
|
||||||
local input = {1, available = 0} -- input data offset and available size
|
local input = {1, available = 0} -- input data offset and available size
|
||||||
if len > 0 then
|
if len > 0 then
|
||||||
print("Reading payload body")
|
|
||||||
data, err = read_func(len)
|
data, err = read_func(len)
|
||||||
print("Reading payload body done")
|
|
||||||
else
|
else
|
||||||
data = ""
|
data = ""
|
||||||
end
|
end
|
||||||
@ -520,7 +516,6 @@ function protocol.start_parse_packet(read_func)
|
|||||||
return res
|
return res
|
||||||
end
|
end
|
||||||
|
|
||||||
print("Available data is: " .. input.available)
|
|
||||||
return ptype, flags, input
|
return ptype, flags, input
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user