On Fri, 31 Dec 2010, Steve Legg wrote:
Am I wrong, and there is actually a way for reqPTY_state to be set back to
idle? Or is this a real bug?
It looks like a real bug to me!
(it looks to me like the code has been written with asynchrony in mind, but
never actually finished - the reqPTY_state code appears to be mostly
redundant).
Not entirely redundant since it avoids doing all that initing of the packet
during situations when the transport layer returns LIBSSH2_ERROR_EAGAIN.
How about fixing this bug with a patch like the attached?
--
/ daniel.haxx.se
diff --git a/src/channel.c b/src/channel.c
index e4a23c1..e0af14c 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -1002,6 +1002,7 @@ channel_request_pty_size(LIBSSH2_CHANNEL * channel, int width,
LIBSSH2_SESSION *session = channel->session;
unsigned char *s;
int rc;
+ int retcode = LIBSSH2_ERROR_PROTO;
if (channel->reqPTY_state == libssh2_NB_state_idle) {
channel->reqPTY_packet_len = 39;
@@ -1044,15 +1045,11 @@ channel_request_pty_size(LIBSSH2_CHANNEL * channel, int width,
"Unable to send window-change packet");
}
_libssh2_htonu32(channel->reqPTY_local_channel, channel->local.id);
- channel->reqPTY_state = libssh2_NB_state_sent;
-
- return LIBSSH2_ERROR_NONE;
+ retcode = LIBSSH2_ERROR_NONE;
}
channel->reqPTY_state = libssh2_NB_state_idle;
-
- /* reaching this point is a protocol error of some sorts */
- return LIBSSH2_ERROR_PROTO;
+ return retcode;
}
LIBSSH2_API int
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel