Subject: [libssh2] Problem found in blocking mode

[libssh2] Problem found in blocking mode

From: James Housley <jim_at_thehousleys.net>
Date: Fri, 3 Aug 2007 10:44:42 -0400

I found a problem in blocking mode, this is causing the problems in
the ssh2.c example. The problem is in libssh2_packet_requirev_ex()
in these lines:

     while (session->socket_state != LIBSSH2_SOCKET_DISCONNECTED) {
         int ret = libssh2_packet_read(session);
         if ((ret < 0) && (ret != PACKET_EAGAIN)) {
             state->start = 0;
             return ret;
         }
         if (ret <= 0) {
             long left = LIBSSH2_READ_TIMEOUT - (time(NULL) - state-
>start);

             if ((left <= 0) || (libssh2_waitsocket(session, left) <=
0 )) {
                 state->start = 0;
                 return PACKET_TIMEOUT;
             }
             else if (ret == PACKET_EAGAIN) {
                 return PACKET_EAGAIN;
             }
         }

         if (strchr((char *)packet_types, ret)) {
             /* Be lazy, let packet_ask pull it out of the brigade */
             return libssh2_packet_askv_ex(session, packet_types,
data, data_len, match_ofs, match_buf, match_len, 0);
         }
     }

libssh2_packet_read() is returning -1

Jim

--
/"\   ASCII Ribbon Campaign  .
\ / - NO HTML/RTF in e-mail  .
  X  - NO Word docs in e-mail .
/ \ -----------------------------------------------------------------
                      http://www.FreeBSD.org     The Power to Serve
jim@TheHousleys.Net  http://www.TheHousleys.net
---------------------------------------------------------------------
Do not meddle in the affairs of dragons, for you are crunchy and taste
     good with ketchup.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel
Received on 2007-08-03