Peter Stuge wrote: > Jasmeet Bagga wrote: > >>> [libssh2] 0.956992 Socket: Recved 0 bytes banner > >>> [libssh2] 0.956996 Failure Event: -43 - Failed getting banner > >>> [libssh2] 0.957045 Transport: Disconnecting: reason=11, desc=, lang= > >> > >> The log shows that the problem is very very early. > > > > JFYI, the problem was that the remote device has a very low rate > > limit for ssh connections and it was abruptly terminating ssh > > connections (after the TCP connection succeeded), leading to the > > above seen errors. > > Sure. > > So one thing that could be improved about libssh2 here is the > reported error. Currently you get LIBSSH2_ERROR_SOCKET_RECV but it > could be made more clear that the connection was unexpectedly closed. > > Do you have some suggestion for a more useful error code?
How about the attached? //Peter
>From 6a04c4eb3a55d4959b847a6cde719f1470bd16f9 Mon Sep 17 00:00:00 2001 From: Peter Stuge <pe...@stuge.se> Date: Tue, 17 Apr 2012 05:03:43 +0200 Subject: [PATCH] Return LIBSSH2_ERROR_SOCKET_DISCONNECT on EOF when reading banner --- src/session.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/session.c b/src/session.c index c2be738..77ab9bc 100644 --- a/src/session.c +++ b/src/session.c @@ -143,7 +143,7 @@ banner_receive(LIBSSH2_SESSION * session) if (ret == 0) { session->socket_state = LIBSSH2_SOCKET_DISCONNECTED; - return LIBSSH2_ERROR_SOCKET_RECV; + return LIBSSH2_ERROR_SOCKET_DISCONNECT; } if (c == '\0') { -- 1.7.4.1.343.ga91df.dirty
_______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel