Subject: Re: [libssh2] #198: _libssh2_channel_close() may hang

Re: [libssh2] #198: _libssh2_channel_close() may hang

From: libssh2 Trac <trac_at_libssh2.stuge.se>
Date: Fri, 10 Dec 2010 23:20:07 -0000

#198: _libssh2_channel_close() may hang
---------------------+------------------------------------------------------
  Reporter: fd64 | Owner: bagder
      Type: defect | Status: accepted
  Priority: normal | Milestone: 1.2.7
 Component: API | Version: 1.2.7
Resolution: | Keywords:
    Blocks: | Blocked By:
---------------------+------------------------------------------------------
Changes (by bagder):

  * owner: => bagder
  * status: new => accepted

Comment:

 What about this patch:

 {{{
 diff --git a/src/channel.c b/src/channel.c
 index ff1fb4d..efe95e6 100644
 --- a/src/channel.c
 +++ b/src/channel.c
 @@ -2304,9 +2304,9 @@ int _libssh2_channel_close(LIBSSH2_CHANNEL *
 channel)
      if (channel->close_state == libssh2_NB_state_sent) {
          /* We must wait for the remote SSH_MSG_CHANNEL_CLOSE message */

 - while (!channel->remote.close && !rc) {
 + while (!channel->remote.close && !rc &&
 + (session->socket_state != LIBSSH2_SOCKET_DISCONNECTED))
              rc = _libssh2_transport_read(session);
 - }
      }

      if(rc != LIBSSH2_ERROR_EAGAIN) {

 }}}

-- 
Ticket URL: <http://trac.libssh2.org/ticket/198#comment:4>
libssh2 <http://trac.libssh2.org/>
C library for writing portable SSH2 clients
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-12-11