You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am building non-blocking sftp support for pylibssh2.
It works just fine except for one thing. When I do a sftp.open or sftp.opendir in non blocking mode, I have to call libssh2_session_last_error to see if this was a EGAIN or some genuine error.
I was not able to access session object from the sftp object in the sftp handle.
I have however worked around this problem by keeping pointer to session object in sftp handle.
Now on my local, sftp works beautifully in non blocking mode.
This is what the code for opendir looks like:
Py_BEGIN_ALLOW_THREADS
handle = libssh2_sftp_opendir(self->sftp, path);
Py_END_ALLOW_THREADS
if (handle == NULL) {
if (libssh2_session_last_error(self->session, NULL, NULL, 0) ==
LIBSSH2_ERROR_EAGAIN){
return Py_BuildValue("");
}
else{
/* CLEAN: PYLIBSSH2_SFTPHANDLE_CANT_OPENDIR_MSG */
PyErr_SetString(PYLIBSSH2_Error, "Unable to open sftp directory.");
return NULL;
}
}
Before I send in a merge request, I wanted to make sure if this approach is okay, or if there are other (better) ways to do this.
The text was updated successfully, but these errors were encountered:
I have also tried this:
channel = libssh2_sftp_get_channel(self->sftp);
if (libssh2_session_last_error(channel->session, NULL, NULL, 0) ==
LIBSSH2_ERROR_EAGAIN){
This also fails to compile with error:
src/sftp.c:276:45: error: dereferencing pointer to incomplete type
I am building non-blocking sftp support for pylibssh2.
It works just fine except for one thing. When I do a sftp.open or sftp.opendir in non blocking mode, I have to call libssh2_session_last_error to see if this was a EGAIN or some genuine error.
I was not able to access session object from the sftp object in the sftp handle.
I have however worked around this problem by keeping pointer to session object in sftp handle.
Now on my local, sftp works beautifully in non blocking mode.
This is what the code for opendir looks like:
Before I send in a merge request, I wanted to make sure if this approach is okay, or if there are other (better) ways to do this.
The text was updated successfully, but these errors were encountered: