In src/session.c, libssh2_session_startup() sets the session socket to
blocking mode, calls libssh2_banner_send() then calls
libssh2_banner_receive().

If the connection is dropped by the client between those two calls,
libssh2_banner_receive() hard loops doing recv()'s that are returning 0.

The culprit seems to be the "if (ret <= 0) continue;" code.  Placing the
continue in the loop above (which is "if (ret < 0 )") and adding code to
check for zero seems to do the trick:

            } else {
                /* Some kinda error */
                session->banner_TxRx_state = libssh2_NB_state_idle;
                session->banner_TxRx_total_send = 0;
                return 1;
            }
            continue;
        }

        if (ret == 0) {
            /* EOF */
            session->banner_TxRx_state = libssh2_NB_state_idle;
            session->banner_TxRx_total_send = 0;
            return 1;
        }

David




***********************************************************************
Bear Stearns is not responsible for any recommendation, solicitation, 
offer or agreement or any information about any transaction, customer 
account or account activity contained in this communication.
***********************************************************************

-------------------------------------------------------------------------
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@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel

Reply via email to