Subject: [libssh2] EINTR treatment at session.c/ _libssh2_wait_socket()

[libssh2] EINTR treatment at session.c/ _libssh2_wait_socket()

From: Nick Rudnick <nick.rudnick_at_googlemail.com>
Date: Mon, 30 Apr 2012 11:31:00 +0200

Dear all,

thanks to your help I was able to find a workaround for my problem, being
in relation to Haskell and maybe other languages emitting signals that may
interfere libssh2 processing (info thanks to Edward Z. Yang):

http://hackage.haskell.org/trac/ghc/wiki/Commentary/Rts/Signals

This problem seems to be solved by a very small modification (diff file is
attached):

663,664c663,666
< session->err_code = LIBSSH2_ERROR_TIMEOUT;
< return LIBSSH2_ERROR_TIMEOUT;

---
>     if(errno != EINTR){
>             session->err_code = LIBSSH2_ERROR_TIMEOUT;
>             return LIBSSH2_ERROR_TIMEOUT;
>     }
Pondering the operational semantics of  _libssh2_wait_socket() now, with
the impression that an EINTR usually would be regarded as a transient
incident, I am asking myself in how far not aborting at EINTR might violate
the intended behavior in any way.
If there were no objections, an introduction to the code base would be
great – especially on Windows, where a necessity to compile often means a
considerable amount of effort.
Thanks a lot for your support, Nick


_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

Received on 2012-04-30