#257: [PATCH] libssh2_session_free: infinite loop
-----------------------+-------------------
  Reporter:  greg2001  |      Owner:
      Type:  defect    |     Status:  new
  Priority:  normal    |  Milestone:  1.4.3
 Component:  API       |    Version:  1.4.2
Resolution:            |   Keywords:
Blocked By:            |     Blocks:
-----------------------+-------------------

Comment (by ncm):

 It wasn't immediately clear to me that the infinite loop you point
 to occurs *inside* libssh2.

 I think the solution is not to change _libssh2_channel_forward_cancel,
 but to change the loop so that if a listener reports an unrecoverable
 error, the whole connection should be dropped, unceremoniously.
 Actually closing the physical socket connection should be a valid
 response to all errors.  Since the library cannot close the socket,
 the client needs to know when that is the right choice.

 Thus,
 {{{
     while ((l = _libssh2_list_first(&session->listeners))) {
         rc = _libssh2_channel_forward_cancel(l);
 -        if (rc == LIBSSH2_ERROR_EAGAIN)
 +        if (rc)
             return rc;
     }
 }}}

-- 
Ticket URL: <https://trac.libssh2.org/ticket/257#comment:1>
libssh2 <https://trac.libssh2.org/>
C library for writing portable SSH2 clients

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

Reply via email to