[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: luasocket passive ftp hack
- From: Steve Elkins <sgelkins@...>
- Date: Sun, 21 Sep 2003 23:26:31 -0400
On Sun, 21 Sep 2003 20:45:55 -0400 (EDT)
Diego Nehab <diego@tecgraf.puc-rio.br> wrote:
> default behaviour for FTP. I left the old PASV code there because some
> day I would like to find out how to fallback to passive mode if the
> active mode fails, or perhaps allow the user to chose the data
> connection mode.
Another experiment involved adding one or two lines to ftp.lua, in
Private.retrieve:
@@ -293,11 +293,13 @@
end
if not code then return nil, answer end
data, answer = server:accept()
+ print('data,answer =',data,answer)
server:close()
if not data then
control:close()
return answer
end
+ data:settimeout(Public.TIMEOUT)
answer = Private.receive_indirect(data, content_cb)
if answer then
control:close()
With just the first line added, the print statement runs after the
timeout set in Private.port expires and then it hangs until ^C minutes
later.
data,answer = userdata: 0x41010 nil
stack traceback:
[C]: in function `receive'
ftptimeout.lua:35: in function `try_receive'
ftptimeout.lua:265: in function `receive_indirect'
ftptimeout.lua:302: in function `retrieve'
ftptimeout.lua:495: in function `download'
ftptimeout.lua:582: in function `get_cb'
ftptimeout.lua:651: in function `get'
bsgetindex.lua:10: in main chunk
[C]: ?
With both lines added the receive times out after another minute but
not even 'lua -i etc.' leaves it in the interpreter. Instead it quits
and I'm back at the shell prompt.
Cheers,
Steve