-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
copas.step() throws error #21
Comments
Is this a theoretical question, or did you actually run into this? In the
Deducing from that, the error value cannot be different from |
Hello Thijs, unfortunately it is no theory. It is a practical problem. Possibly I I can adjust the behaviour to my personal intention, but certainly there Oliver Am 15.12.2014 um 20:26 schrieb Thijs Schreijer:
|
It is then determined by the reason for the error. That will tell you whether it's a Copas or LuaSocket issue I guess. |
Looks as if there is a discrepancy between socket.select's documentation and implementation. It indeed returns the string "error" and not the value nil. |
I found that there is an error in LuaSocket's implementation / documentation. Most examples, including that on pages 448ff of the book "UNIX Network Programming" by W. Richard Stevens, use select() to wait for the socket becoming writeable and then use getsockopt( ..., SOL_SOCKET, SO_ERROR,...) to retrieve the outcome of connect(). However... LuaSockets 2.0.2 does not document tcp.getoption(), (LuaSocket 3.0 does), but getting the SO_ERROR is not implemented at all. So, for a full implementation, LuaSocket has to be changed. I found that in many implementations people just wait for the socket to become writeable, and then rely on getting an error on using it when it is not actually connected. Would this be an option for copas.connect() ? |
Update... |
fixed in #25 throwing an error was not correct. Docs tell that |
According to its documentation in the reference manual, copas.step() should return nil plus error message in case of errors. However, if _select(), which is called by step(), returns anything (else than "timeout") copas.step() calls error() which stops the whle program, as it is difficult to catch this one.
Is this intentional?
Note: errors in the threads itself are handled.
The text was updated successfully, but these errors were encountered: