Skip to content

Commit 6a1ba93

Browse files
committed
Handle timeouts for blocking calls
1 parent ae25d12 commit 6a1ba93

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: ljsocket.lua

+3-3
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ do
10681068

10691069
local ok, err, num = socket.connect(self.fd, res.addrinfo.ai_addr, res.addrinfo.ai_addrlen)
10701070

1071-
if not ok and not self.blocking then
1071+
if not ok and self.blocking then
10721072
if timeout_messages[num] then
10731073
self.timeout_connected = {host, service}
10741074
return true
@@ -1151,7 +1151,7 @@ do
11511151

11521152
local err, num = socket.lasterror()
11531153

1154-
if not self.blocking and timeout_messages[num] then
1154+
if self.blocking and timeout_messages[num] then
11551155
return nil, "timeout", num
11561156
end
11571157

@@ -1274,7 +1274,7 @@ do
12741274
end
12751275

12761276
if not len then
1277-
if not self.blocking and timeout_messages[num] then
1277+
if self.blocking and timeout_messages[num] then
12781278
return nil, "timeout", num
12791279
end
12801280

0 commit comments

Comments
 (0)