From: jluehrs2 Date: Tue, 4 Sep 2007 23:20:01 +0000 (-0500) Subject: sock:bind() failure invalidates the socket's file descriptor X-Git-Tag: 0.03~27 X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=b37239c2f9b627457b6a2147faa0821b20380e96;p=luairc.git sock:bind() failure invalidates the socket's file descriptor --- diff --git a/src/irc/dcc.lua b/src/irc/dcc.lua index 5b9f8a1..5567695 100644 --- a/src/irc/dcc.lua +++ b/src/irc/dcc.lua @@ -151,8 +151,9 @@ end -- above) function send(nick, filename, port) port = port or FIRST_PORT - local sock = base.assert(socket.tcp()) + local sock repeat + sock = base.assert(socket.tcp()) err, msg = sock:bind('*', port) port = port + 1 until msg ~= "address already in use" and port <= LAST_PORT + 1