1
1

- (Feb 20 2009) libssh2_channel_direct_tcpip_ex() bug #1902169 fixed, which

caused it to fail when called a second time.
Этот коммит содержится в:
Daniel Stenberg 2009-02-20 16:14:45 +00:00
родитель d722e09196
Коммит 1addcbbf53
2 изменённых файлов: 12 добавлений и 4 удалений

3
NEWS
Просмотреть файл

@ -1,4 +1,7 @@
- (Feb 20 2009) libssh2_channel_direct_tcpip_ex() bug #1902169 fixed, which
caused it to fail when called a second time.
- (Feb 12 2009) Romain Bondue extended Markus Moeller fix from Feb 8, based on
a previous (uncommitted) patch by Erik Brossler. It improves
libssh2_channel_write_ex in blocking situations when the socket is set non-

Просмотреть файл

@ -1,5 +1,5 @@
/* Copyright (c) 2004-2007, Sara Golemon <sarag@libssh2.org>
* Copyright (c) 2008 by Daniel Stenberg
* Copyright (c) 2008-2009 by Daniel Stenberg
*
* All rights reserved.
*
@ -368,8 +368,6 @@ libssh2_channel_direct_tcpip_ex(LIBSSH2_SESSION * session, const char *host,
s += session->direct_shost_len;
libssh2_htonu32(s, sport);
s += 4;
session->direct_state = libssh2_NB_state_created;
}
channel =
@ -379,9 +377,16 @@ libssh2_channel_direct_tcpip_ex(LIBSSH2_SESSION * session, const char *host,
LIBSSH2_CHANNEL_PACKET_DEFAULT,
(char *) session->direct_message,
session->direct_message_len);
/* by default we set (keep?) idle state... */
session->direct_state = libssh2_NB_state_idle;
if (!channel) {
if (libssh2_session_last_errno(session) == LIBSSH2_ERROR_EAGAIN) {
/* The error code is still set to LIBSSH2_ERROR_EAGAIN */
/* The error code is still set to LIBSSH2_ERROR_EAGAIN,
set our state to created to avoid re-creating the package
on next invoke */
session->direct_state = libssh2_NB_state_created;
return NULL;
} else {
LIBSSH2_FREE(session, session->direct_message);