[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Copas weirdness
- From: David Given <dg@...>
- Date: Tue, 05 Apr 2011 15:18:25 +0000
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?
This is probably the cause of the first failure mode, then.
[...]
> On the closing sockets, copas will close the socket in case an error
> occurs (line 261 in copas.lua, function _doTick). The default behavior
> is to log the error to stdout, though you can change it by setting
> your own error handler by calling copas.setErrorHandler(func) in the
> server thread, Copas will then call func with the error message, the
> thread and the socket in case of errors. This might help diagnose the
> problem.
I hadn't noticed any errors, but shall investigate further and report back.
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?
--
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│ "I have always wished for my computer to be as easy to use as my
│ telephone; my wish has come true because I can no longer figure out
│ how to use my telephone." --- Bjarne Stroustrup
Attachment:
signature.asc
Description: OpenPGP digital signature