[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Copas weirdness
- From: Fabio Mascarenhas <mascarenhas@...>
- Date: Tue, 5 Apr 2011 17:26:06 -0300
On Tue, Apr 5, 2011 at 12:18 PM, David Given <dg@cowlark.com> wrote:
> On 05/04/11 13:52, Fabio Mascarenhas wrote:
> [...]
>> copas.wrap does not put the socket in nonblocking mode for you. You
>> have to do it yourself, with :settimeout(0) in the raw socket before
>> calling the first :receive or :send in the wrapped socket. But notice
>> that copas reads and writes still block from the point of view of the
>> server thread, as the purpose of copas is to simulate multithreading.
>
> Ah --- this isn't obvious; ta. If I don't do this, then calling
> copas.read() or copas.write() will cause the whole program to block, right?
Yes. But notice that from the point of view of each server thread they
are still blocking even with timeout set to 0, but the program as a
whole is async.
> This is probably the cause of the first failure mode, then.
Perhaps, as I do not know if you were complaining about the copas
thread blocking or the whole program blocking.
>
>
> I hadn't noticed any errors, but shall investigate further and report back.
This is the only case where copas explicitly closes a socket, so if it
is not reporting any errors than they are being closed by someone else
(connection reset by peer, perhaps?).
> I do notice that setErrorHandler() isn't in the reference manual at
> http://keplerproject.github.com/copas/reference.html... is there more
> up-to-date documentation I should be reading?
This was supposed to the up-to-date documentation. :-) I have commit
access to the repo, so have just added setErrorHandler to it. Sorry.
--
Fabio Mascarenhas