Modify the code to truely support non-blocking. Propogate the EAGAIN error
all the way up to the user interface. All code modules bug sftp.c have been completed. Functions that return an "int", or similar return LIBSSH2CHANNEL_EAGAIN to indicate some part of the call would block, in non-blocking mode. Functions that return a structure, like "LIBSSH2_CHANNEL *", return NULL and set the libssh2 error. The error can be obtained with either libssh2_session_last_error() or libssh2_session_last_errno(). Either of these will return the error code of LIBSSH2_ERROR_EAGAIN if the call would block, in non-blocking mode. The current state of a function and some variable are keep in the structures so that on the next call the operation that would block can be retried again with the same data.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# $Id: Makefile.am,v 1.5 2007/04/22 19:51:53 jehousley Exp $
|
||||
# $Id: Makefile.am,v 1.6 2007/06/06 12:34:06 jehousley Exp $
|
||||
|
||||
EXTRA_DIST = template.3
|
||||
|
||||
@@ -10,4 +10,5 @@ dist_man_MANS = libssh2_channel_forward_accept.3 \
|
||||
libssh2_session_free.3 libssh2_poll.3 libssh2_poll_channel_read.3 \
|
||||
libssh2_sftp_read.3 libssh2_sftp_readnb.3 libssh2_sftp_readdir.3 \
|
||||
libssh2_sftp_readdirnb.3 libssh2_sftp_mkdir_ex.3 \
|
||||
libssh2_sftp_mkdirnb_ex.3
|
||||
libssh2_sftp_mkdirnb_ex.3 libssh2_session_disconnect_ex.3 \
|
||||
libssh2_channel_wait_eof.3
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.\" $Id: libssh2_channel_forward_accept.3,v 1.1 2006/12/21 14:09:12 bagder Exp $
|
||||
.\" $Id: libssh2_channel_forward_accept.3,v 1.2 2007/06/06 12:34:06 jehousley Exp $
|
||||
.\"
|
||||
.TH libssh2_channel_forward_accept 3 "14 Dec 2006" "libssh2 0.15" "libssh2 manual"
|
||||
.TH libssh2_channel_forward_accept 3 "1 June 2007" "libssh2 0.15" "libssh2 manual"
|
||||
.SH NAME
|
||||
libssh2_channel_forward_accept - accept a queued connection
|
||||
.SH SYNOPSIS
|
||||
@@ -12,5 +12,8 @@ libssh2_channel_forward_accept - accept a queued connection
|
||||
\fBlibssh2_channel_forward_listen(3)\fP.
|
||||
.SH RETURN VALUE
|
||||
A newly allocated channel instance or NULL on failure.
|
||||
.SH ERRORS
|
||||
LIBSSH2_ERROR_EAGAIN
|
||||
Marked for non-blocking I/O but the call would block.
|
||||
.SH "SEE ALSO"
|
||||
.BI libssh2_channel_forward_listen(3)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.\" $Id: libssh2_channel_forward_listen_ex.3,v 1.2 2007/04/12 21:30:03 dfandrich Exp $
|
||||
.\" $Id: libssh2_channel_forward_listen_ex.3,v 1.3 2007/06/06 12:34:06 jehousley Exp $
|
||||
.\"
|
||||
.TH libssh2_channel_forward_listen_ex 3 "14 Dec 2006" "libssh2 0.15" "libssh2 manual"
|
||||
.TH libssh2_channel_forward_listen_ex 3 "1 June 2007" "libssh2 0.15" "libssh2 manual"
|
||||
.SH NAME
|
||||
libssh2_channel_forward_listen_ex - listen to inbound connections
|
||||
.SH SYNOPSIS
|
||||
@@ -36,5 +36,8 @@ rejecting further attempts.
|
||||
\fIlibssh2_channel_forward_listen(3)\fP is a macro.
|
||||
.SH RETURN VALUE
|
||||
A newly allocated LIBSSH2_LISTENER instance or NULL on failure.
|
||||
.SH ERRORS
|
||||
LIBSSH2_ERROR_EAGAIN
|
||||
Marked for non-blocking I/O but the call would block.
|
||||
.SH "SEE ALSO"
|
||||
.BI libssh2_channel_forward_accept(3)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.\" $Id: libssh2_channel_read_ex.3,v 1.5 2007/02/23 10:20:56 bagder Exp $
|
||||
.\" $Id: libssh2_channel_read_ex.3,v 1.6 2007/06/06 12:34:06 jehousley Exp $
|
||||
.\"
|
||||
.TH libssh2_channel_read_ex 3 "14 Dec 2006" "libssh2 0.15" "libssh2 manual"
|
||||
.TH libssh2_channel_read_ex 3 "1 June 2007" "libssh2 0.15" "libssh2 manual"
|
||||
.SH NAME
|
||||
libssh2_channel_read_ex - read data from a channel stream
|
||||
.SH SYNOPSIS
|
||||
@@ -31,6 +31,8 @@ currently defines a stream ID of 1 to be the stderr substream.
|
||||
\fIlibssh2_channel_read(3)\fP and \fIlibssh2_channel_read_stderr(3)\fP are
|
||||
macros.
|
||||
.SH RETURN VALUE
|
||||
Actual number of bytes read or negative on failure.
|
||||
Actual number of bytes read or negative on failure. It returns
|
||||
LIBSSH2CHANNEL_EAGAIN when it would otherwise block. While
|
||||
LIBSSH2CHANNEL_EAGAIN is a negative number, it isn't really a failure per se.
|
||||
.SH "SEE ALSO"
|
||||
.BR libssh2_poll_channel_read(3)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.\" $Id: libssh2_channel_readnb_ex.3,v 1.2 2007/02/23 10:20:56 bagder Exp $
|
||||
.\" $Id: libssh2_channel_readnb_ex.3,v 1.3 2007/06/06 12:34:06 jehousley Exp $
|
||||
.\"
|
||||
.TH libssh2_channel_read_ex 3 "14 Dec 2006" "libssh2 0.15" "libssh2 manual"
|
||||
.TH libssh2_channel_read_ex 3 "1 June 2007" "libssh2 0.15" "libssh2 manual"
|
||||
.SH NAME
|
||||
libssh2_channel_read_ex - read data from a channel stream
|
||||
.SH SYNOPSIS
|
||||
|
||||
19
docs/libssh2_channel_wait_eof.3
Normal file
19
docs/libssh2_channel_wait_eof.3
Normal file
@@ -0,0 +1,19 @@
|
||||
.\" $Id: libssh2_channel_wait_eof.3,v 1.1 2007/06/06 12:34:06 jehousley Exp $
|
||||
.\"
|
||||
.TH libssh2_channel_wait_eof 3 "1 June 2007" "libssh2 0.15" "libssh2 manual"
|
||||
.SH NAME
|
||||
libssh2_channel_wait_eof - wait for the remote to reply to an EOF request
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
int libssh2_channel_wait_eof(LIBSSH2_CHANNEL *channel);
|
||||
|
||||
.SH DESCRIPTION
|
||||
Wait for the remote end to acknowledge an EOF request.
|
||||
|
||||
.SH RETURN VALUE
|
||||
Return 0 on success or negative on failure. It returns
|
||||
LIBSSH2CHANNEL_EAGAIN when it would otherwise block. While
|
||||
LIBSSH2CHANNEL_EAGAIN is a negative number, it isn't really a failure per se.
|
||||
.SH "SEE ALSO"
|
||||
.BI libssh2_channel_send_eof(3), libssh2_channel_eof(3)
|
||||
@@ -1,19 +1,19 @@
|
||||
.\" $Id: libssh2_channel_write_ex.3,v 1.1 2007/02/23 10:20:56 bagder Exp $
|
||||
.\" $Id: libssh2_channel_write_ex.3,v 1.2 2007/06/06 12:34:06 jehousley Exp $
|
||||
.\"
|
||||
.TH libssh2_channel_write_ex 3 "6 Feb 2007" "libssh2 0.15" "libssh2 manual"
|
||||
.TH libssh2_channel_write_ex 3 "1 June 2007" "libssh2 0.15" "libssh2 manual"
|
||||
.SH NAME
|
||||
libssh2_channel_write_ex - write data to a channel stream blocking
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
int libssh2_channel_write_ex(LIBSSH2_CHANNEL *channel, int stream_id,
|
||||
char *buf, size_t buflen);
|
||||
size_t libssh2_channel_write_ex(LIBSSH2_CHANNEL *channel, int stream_id,
|
||||
char *buf, size_t buflen);
|
||||
|
||||
int libssh2_channel_write(LIBSSH2_CHANNEL *channel, char *buf,
|
||||
size_t buflen);
|
||||
size_t libssh2_channel_write(LIBSSH2_CHANNEL *channel, char *buf,
|
||||
size_t buflen);
|
||||
|
||||
int libssh2_channel_write_stderr(LIBSSH2_CHANNEL *channel, char *buf,
|
||||
size_t buflen);
|
||||
size_t libssh2_channel_write_stderr(LIBSSH2_CHANNEL *channel, char *buf,
|
||||
size_t buflen);
|
||||
.SH DESCRIPTION
|
||||
Write data to a channel stream. All channel streams have one standard I/O
|
||||
substream (stream_id == 0), and may have up to 2^32 extended data streams as
|
||||
@@ -32,6 +32,8 @@ defines a stream ID of 1 to be the stderr substream.
|
||||
macros.
|
||||
.SH RETURN VALUE
|
||||
Actual number of bytes written or negative on failure.
|
||||
LIBSSH2CHANNEL_EAGAIN when it would otherwise block. While
|
||||
LIBSSH2CHANNEL_EAGAIN is a negative number, it isn't really a failure per se.
|
||||
.SH "SEE ALSO"
|
||||
.BR libssh2_channel_open_session(3)
|
||||
.BR libssh2_channel_read(3)
|
||||
|
||||
20
docs/libssh2_session_disconnect_ex.3
Normal file
20
docs/libssh2_session_disconnect_ex.3
Normal file
@@ -0,0 +1,20 @@
|
||||
.\" $Id: libssh2_session_disconnect_ex.3,v 1.1 2007/06/06 12:34:07 jehousley Exp $
|
||||
.\"
|
||||
.TH libssh2_session_disconnect_ex 3 "1 June 2007" "libssh2 0.15" "libssh2 manual"
|
||||
.SH NAME
|
||||
libssh2_session_disconnect_ex - terminate transport layer
|
||||
.SH SYNOPSIS
|
||||
#include <libssh2.h>
|
||||
|
||||
int ibssh2_session_disconnect_ex(LIBSSH2_SESSION *session, int reason, const char *description, const char *lang);
|
||||
.SH DESCRIPTION
|
||||
Terminates the transport layer connection with the remote host.
|
||||
Note that all authentication and connection layer objects become unusable
|
||||
at this point and should be explicitly freed prior to disconnection.
|
||||
.SH RETURN VALUE
|
||||
0 on success, \-1 on failure
|
||||
.SH ERRORS
|
||||
LIBSSH2_ERROR_EAGAIN
|
||||
Marked for non-blocking I/O but the call would block.
|
||||
.SH "SEE ALSO"
|
||||
.BI libssh2_session_init(3)
|
||||
@@ -1,6 +1,6 @@
|
||||
.\" $Id: libssh2_session_init.3,v 1.2 2007/04/12 21:30:03 dfandrich Exp $
|
||||
.\" $Id: libssh2_session_init.3,v 1.3 2007/06/06 12:34:07 jehousley Exp $
|
||||
.\"
|
||||
.TH libssh2_session_init 3 "14 Dec 2006" "libssh2 0.15" "libssh2 manual"
|
||||
.TH libssh2_session_init 3 "1 June 2007" "libssh2 0.15" "libssh2 manual"
|
||||
.SH NAME
|
||||
libssh2_session_init - initializes an SSH session object
|
||||
.SH SYNOPSIS
|
||||
@@ -24,6 +24,9 @@ This method must be called first, prior to configuring session options or
|
||||
starting up an SSH session with a remote server.
|
||||
.SH RETURN VALUE
|
||||
Pointer to a newly allocated LIBSSH2_SESSION instance, or NULL on errors.
|
||||
.SH ERRORS
|
||||
LIBSSH2_ERROR_EAGAIN
|
||||
Marked for non-blocking I/O but the call would block.
|
||||
.SH "SEE ALSO"
|
||||
.BI libssh2_session_free(3),
|
||||
.BI libssh2_session_startup(3)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.\" $Id: libssh2_session_startup.3,v 1.2 2007/01/02 05:47:00 gusarov Exp $
|
||||
.\" $Id: libssh2_session_startup.3,v 1.3 2007/06/06 12:34:07 jehousley Exp $
|
||||
.\"
|
||||
.TH libssh2_session_startup 3 "14 Dec 2006" "libssh2 0.15" "libssh2 manual"
|
||||
.TH libssh2_session_startup 3 "1 June 2007" "libssh2 0.15" "libssh2 manual"
|
||||
.SH NAME
|
||||
libssh2_session_startup - begin transport layer
|
||||
.SH SYNOPSIS
|
||||
@@ -11,6 +11,27 @@ int libssh2_session_startup(LIBSSH2_SESSION *session, int socket);
|
||||
Begin transport layer protocol negotiation with the connected host.
|
||||
.SH RETURN VALUE
|
||||
0 on success, \-1 on failure
|
||||
.SH ERRORS
|
||||
LIBSSH2_ERROR_SOCKET_NONE
|
||||
Bad socket provided.
|
||||
.br
|
||||
LIBSSH2_ERROR_BANNER_SEND
|
||||
Error sending banner to remote host.
|
||||
.br
|
||||
LIBSSH2_ERROR_KEX_FAILURE
|
||||
Unable to exchange encryption keys.
|
||||
.br
|
||||
LIBSSH2_ERROR_SOCKET_SEND
|
||||
Unable to ask for ssh-userauth service.
|
||||
.br
|
||||
LIBSSH2_ERROR_SOCKET_DISCONNECT
|
||||
Connection was lost.
|
||||
.br
|
||||
LIBSSH2_ERROR_PROTO
|
||||
Invalid response received from server.
|
||||
.br
|
||||
LIBSSH2_ERROR_EAGAIN
|
||||
Marked for non-blocking I/O but the call would block.
|
||||
.SH "SEE ALSO"
|
||||
.BI libssh2_session_free(3),
|
||||
.BI libssh2_session_init(3)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.\" $Id: libssh2_sftp_init.3,v 1.2 2007/04/22 17:18:03 jehousley Exp $
|
||||
.\" $Id: libssh2_sftp_init.3,v 1.3 2007/06/06 12:34:07 jehousley Exp $
|
||||
.\"
|
||||
.TH libssh2_sftp_init 3 "23 Jan 2007" "libssh2 0.15" "libssh2 manual"
|
||||
.TH libssh2_sftp_init 3 "1 June 2007" "libssh2 0.15" "libssh2 manual"
|
||||
.SH NAME
|
||||
libssh2_sftp_init -
|
||||
.SH SYNOPSIS
|
||||
@@ -17,5 +17,8 @@ session is complete, it must be destroyed using the
|
||||
\fIlibssh2_sftp_shutdown(3)\fP function.
|
||||
.SH RETURN VALUE
|
||||
A pointer to the newly allocated SFTP instance or NULL on failure.
|
||||
.SH ERRORS
|
||||
LIBSSH2_ERROR_EAGAIN
|
||||
Marked for non-blocking I/O but the call would block.
|
||||
.SH "SEE ALSO"
|
||||
.BI libssh2_sftp_shutdown(3), libssh2_sftp_open_ex(3)
|
||||
|
||||
Reference in New Issue
Block a user