From 0c53895bc0e02c8d2722eff0da2c8e6e47ebf72e Mon Sep 17 00:00:00 2001 From: Mikhail Gusarov Date: Fri, 24 Jun 2005 11:22:10 +0000 Subject: [PATCH] libssh2_poll_channel_read made external --- include/libssh2.h | 2 ++ src/session.c | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/libssh2.h b/include/libssh2.h index f1fc8db..e89cc88 100644 --- a/include/libssh2.h +++ b/include/libssh2.h @@ -350,6 +350,8 @@ LIBSSH2_API int libssh2_channel_read_ex(LIBSSH2_CHANNEL *channel, int stream_id, #define libssh2_channel_read(channel, buf, buflen) libssh2_channel_read_ex((channel), 0, (buf), (buflen)) #define libssh2_channel_read_stderr(channel, buf, buflen) libssh2_channel_read_ex((channel), SSH_EXTENDED_DATA_STDERR, (buf), (buflen)) +LIBSSH2_API int libssh2_poll_channel_read(LIBSSH2_CHANNEL *channel, int extended); + LIBSSH2_API unsigned long libssh2_channel_window_read_ex(LIBSSH2_CHANNEL *channel, unsigned long *read_avail, unsigned long *window_size_initial); #define libssh2_channel_window_read(channel) libssh2_channel_window_read_ex((channel), NULL, NULL) diff --git a/src/session.c b/src/session.c index f2a95e1..27cc685 100644 --- a/src/session.c +++ b/src/session.c @@ -682,7 +682,7 @@ LIBSSH2_API int libssh2_session_flag(LIBSSH2_SESSION *session, int flag, int val * Returns 0 if no data is waiting on channel, * non-0 if data is available */ -static int libssh2_poll_channel_read(LIBSSH2_CHANNEL *channel, int extended) +LIBSSH2_API int libssh2_poll_channel_read(LIBSSH2_CHANNEL *channel, int extended) { LIBSSH2_SESSION *session = channel->session; LIBSSH2_PACKET *packet = session->packets.head; @@ -694,7 +694,7 @@ static int libssh2_poll_channel_read(LIBSSH2_CHANNEL *channel, int extended) return 1; } packet = packet->next; - } + } return 0; } @@ -832,7 +832,7 @@ LIBSSH2_API int libssh2_poll(LIBSSH2_POLLFD *fds, unsigned int nfds, long timeou fds[i].revents |= LIBSSH2_POLLFD_CHANNEL_CLOSED | LIBSSH2_POLLFD_SESSION_CLOSED; } break; - case LIBSSH2_POLLFD_LISTENER: + case LIBSSH2_POLLFD_LISTENER: if ((fds[i].events & LIBSSH2_POLLFD_POLLIN) && /* Want a connection */ ((fds[i].revents & LIBSSH2_POLLFD_POLLIN) == 0)) { /* No connections known of yet */ fds[i].revents |= libssh2_poll_listener_queued(fds[i].fd.listener) ? LIBSSH2_POLLFD_POLLIN : 0;