[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: copas.connect() repeats skt:connect()....why?
- From: Paul K <paul@...>
- Date: Sat, 26 Jul 2014 04:13:20 +0000
> I could solve (or bypass) the problem by commenting the lines containing the repeat, the until.. and the return ret, err out and set a return 1 instead:
I don't think this is the correct change. The lines are there to try
another "connect" call if there is a timeout: 'if ret or err ~=
"timeout" then'. If the call is successful or any other error is
returned, then the result of skt:connect is returned. What problem are
you trying to solve with your change?
I've seen this not working on Windows in the way I'd expect by reading
the code, as "connect" on Windows doesn't return "timeout", but
returns "Operation already in progress" instead. I applied the same
solution as described here by Jerome Vuarand:
On Fri, Jul 25, 2014 at 10:42 AM, Oliver Kroth <email@example.com> wrote:
> this issue must have been too difficult, or much too simple...
> I guess the latter. I could solve (or bypass) the problem by commenting the
> lines containing the repeat, the until.. and the return ret, err out and set
> a return 1 instead:
>> function copas.connect(skt, host, port)
>> local ret, err
>> -- repeat
>> ret, err = skt:connect (host, port)
>> if ret or err ~= "timeout" then
>> _writing_log[skt] = nil
>> return ret, err
>> _writing_log[skt] = gettime()
>> coroutine.yield(skt, _writing)
>> -- until false
>> -- return ret, err
>> return 1
> Now it works.
> I tell it just in case someone listens to my soliloquy ;-)