lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Yes. There are two "timeout" mixed. I agree. But there is
rarely enough reason to distinguish between them.
With the socket timeout, you should keep retrying, but
with the other the socket is actually closed and you
better break out of the loop. I believe...  As it is, it
was puzzling me for a while why the server just stopped
getting input but kept running as if nothing had happened.

It should stop on the next timeout, right? When there will
be no partial results.

Nevertheless, there is a bug in the forward.lua sample, I
think. When dispatch.lua aborts the transfer, both data
and partial will be nil. So forward.lua will try to send
nil through bar. I think the following code would fix it:
Sadly i just stumbled to that code while trying to write
my own server... It is based on forward.lua-like loop, but
my server is line based (with skt:receive()). So the
luasocket buffering is hiding the "normal" timeouts from
me (right? at least i've never seen one).

Yes. Everything happens behind your back. dispatch.lua is an
abstraction layer that does just that. Allows you to use
coroutines without even realizing. :) On the other hand, I
didn't test it as thoroughly as the modules that are not
inside /etc. :/