get a usable ip address as soon as possible

This commit is contained in:
jluehrs2 2007-09-04 20:37:03 -05:00
parent 78d18dd18e
commit 47ec4ecd5f
2 changed files with 3 additions and 3 deletions

View File

@ -512,6 +512,7 @@ end
-- loaded? -- loaded?
function ctcp_handlers.on_dcc(from, to, message) function ctcp_handlers.on_dcc(from, to, message)
local type, argument, address, port, size = base.unpack(misc._split(message, " ", nil, '"', '"')) local type, argument, address, port, size = base.unpack(misc._split(message, " ", nil, '"', '"'))
address = misc._ip_int_to_str(address)
if type == "SEND" then if type == "SEND" then
if callback("dcc_send", from, to, argument, address, port, size) then if callback("dcc_send", from, to, argument, address, port, size) then
dcc._accept(argument, address, port) dcc._accept(argument, address, port)

View File

@ -139,11 +139,10 @@ end
-- @param port Port to connect to at the remote user -- @param port Port to connect to at the remote user
-- @param packet_size Size of the packets the remote user will be sending -- @param packet_size Size of the packets the remote user will be sending
function _accept(filename, address, port, packet_size) function _accept(filename, address, port, packet_size)
debug_dcc("Accepting a DCC SEND request from " .. debug_dcc("Accepting a DCC SEND request from " .. address .. ":" .. port)
misc._ip_int_to_str(address) .. ":" .. port)
packet_size = packet_size or 1024 packet_size = packet_size or 1024
local sock = base.assert(socket.tcp()) local sock = base.assert(socket.tcp())
base.assert(sock:connect(misc._ip_int_to_str(address), port)) base.assert(sock:connect(address, port))
sock:settimeout(0.1) sock:settimeout(0.1)
local file = base.assert(io.open(misc._get_unique_filename(filename), "w")) local file = base.assert(io.open(misc._get_unique_filename(filename), "w"))
irc._register_socket(sock, 'r', irc._register_socket(sock, 'r',