Subject: Get rid of get_socket_nonblocking ?

Get rid of get_socket_nonblocking ?

From: Jose Baars <peut_at_peut.org>
Date: Mon, 19 Apr 2010 18:03:47 +0200

Hi,

In trying to get to libssh2 to work on the Multinet TCP/IP stack
on VMS I came across the annoying fact that there is no way
to query the socket blocking state using this stack.
getsockopt, fcntl or any other call fails.

The stack supports setting blocking and nonblocking on a socket,
as one would expect, only querying the socket is impossible,
I decided after several hours of trying.

Examining the code of session .c, I found that this function is only
called in session startup. So I did a bit of testing, and found that
I could get examples sftp.c sftp_nonblock.c to work by changing
session.c :

(Excuse the not very handy format, I have my git repository not at hand)

Old code in session.c :
  600 session->socket_prev_blockstate =
  601 !get_socket_nonblocking(session->socket_fd);
  602
  603 if (session->socket_prev_blockstate) {
  604 /* If in blocking state chang to non-blocking */
  605 session_nonblock(session->socket_fd, 1);
  606 }

new code replacing above old code in session.c :

  600 session->socket_prev_blockstate = session->api_block_mode;
  601 session_nonblock(session->socket_fd, 1);

Three questions:

1. Are there any thinkable circumstances this would fail?
2. Is there a better way to avoid the get_socket_nonblocking function?
3. Or should I give up in trying to get libssh2 to work on the Multinet
TCP/IP stack?

Again sorry for the inconvenient format, but as this very tentative code,
and I absolutely do not have the insight in all design considerations of
libssh2, I was hoping better people on this list could give a quick
appreciation of this change.

Regards,
Jose

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-04-19