diff options
Diffstat (limited to 'etc')
-rw-r--r-- | etc/lp.lua | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -26,10 +26,11 @@ local function connect(localhost, option) | |||
26 | if option.localbind then | 26 | if option.localbind then |
27 | -- bind to a local port (if we can) | 27 | -- bind to a local port (if we can) |
28 | local localport = 721 | 28 | local localport = 721 |
29 | local done, err | ||
29 | repeat | 30 | repeat |
30 | skt = test(socket.tcp()) | 31 | skt = test(socket.tcp()) |
31 | try(skt:settimeout(30)) | 32 | try(skt:settimeout(30)) |
32 | local done, err = skt:bind(localhost, localport) | 33 | done, err = skt:bind(localhost, localport) |
33 | if not done then | 34 | if not done then |
34 | localport = localport + 1 | 35 | localport = localport + 1 |
35 | skt:close() | 36 | skt:close() |
@@ -38,6 +39,7 @@ local function connect(localhost, option) | |||
38 | until localport > 731 | 39 | until localport > 731 |
39 | test(skt, err) | 40 | test(skt, err) |
40 | else skt = test(socket.tcp()) end | 41 | else skt = test(socket.tcp()) end |
42 | print("'" .. host .. "'") | ||
41 | try(skt:connect(host, port)) | 43 | try(skt:connect(host, port)) |
42 | return { skt = skt, try = try } | 44 | return { skt = skt, try = try } |
43 | end | 45 | end |