diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2003-07-05 18:20:13 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2003-07-05 18:20:13 +0000 |
commit | 4b2cbaeefd38dc562dc4ee362033ee2edad06659 (patch) | |
tree | d0d9accd89de6d1db3f523dab6f19e649a3bb2f8 | |
parent | 5e276f90b2a8d508907cc37a19d682b5cba081dd (diff) | |
download | cygnal-4b2cbaeefd38dc562dc4ee362033ee2edad06659.tar.gz cygnal-4b2cbaeefd38dc562dc4ee362033ee2edad06659.tar.bz2 cygnal-4b2cbaeefd38dc562dc4ee362033ee2edad06659.zip |
* fhandler.h (fhandler_socket::get_connect_state): New method to
return socket connection state.
* fhandler_socket.cc (dup): Copy socket connect state to new file
handle.
* net.cc (cygwin_rcmd): Mark file handles of sockets returned by
rcmd() as CONNECTED state.
(cygwin_rexec): Similarly for rexec().
(socketpair): Mark both ends of a new socket pair as CONNECTED.
-rw-r--r-- | winsup/cygwin/ChangeLog | 11 | ||||
-rw-r--r-- | winsup/cygwin/fhandler.h | 1 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_socket.cc | 1 | ||||
-rw-r--r-- | winsup/cygwin/net.cc | 24 |
4 files changed, 32 insertions, 5 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 352df7b9d..fd982faa0 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,14 @@ +2003-07-04 N Stephens <nigel@mips.com> + + * fhandler.h (fhandler_socket::get_connect_state): New method to + return socket connection state. + * fhandler_socket.cc (dup): Copy socket connect state to new file + handle. + * net.cc (cygwin_rcmd): Mark file handles of sockets returned by + rcmd() as CONNECTED state. + (cygwin_rexec): Similarly for rexec(). + (socketpair): Mark both ends of a new socket pair as CONNECTED. + 2003-07-04 Corinna Vinschen <corinna@vinschen.de> * mmap.cc (fhandler_disk_file::mmap): Fix address test. diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 9d037d6d7..44cb155b4 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -412,6 +412,7 @@ class fhandler_socket: public fhandler_base bool is_connect_pending () const {return had_connect_or_listen == CONNECT_PENDING;} bool is_connected () const {return had_connect_or_listen == CONNECTED;} void set_connect_state (int newstate) { had_connect_or_listen = newstate; } + int get_connect_state () const { return had_connect_or_listen; } int bind (const struct sockaddr *name, int namelen); int connect (const struct sockaddr *name, int namelen); diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index 4c66f9e21..5adeaefcb 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -320,6 +320,7 @@ fhandler_socket::dup (fhandler_base *child) if (get_addr_family () == AF_LOCAL) fhs->set_sun_path (get_sun_path ()); fhs->set_socket_type (get_socket_type ()); + fhs->set_connect_state (get_connect_state ()); if (winsock2_active) { diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index ffa4c5100..25d82e110 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -1997,7 +1997,10 @@ cygwin_rcmd (char **ahost, unsigned short inport, char *locuser, if (res_fd >= 0) fh = fdsock (res_fd, "/dev/tcp", res); if (fh) - res = res_fd; + { + fh->set_connect_state (CONNECTED); + res = res_fd; + } else { closesocket (res); @@ -2011,8 +2014,11 @@ cygwin_rcmd (char **ahost, unsigned short inport, char *locuser, fh = NULL; if (newfd >= 0) fh = fdsock (newfd, "/dev/tcp", fd2s); - if (fh) - *fd2p = newfd; + if (fh) + { + *fd2p = newfd; + fh->set_connect_state (CONNECTED); + } else { closesocket (res); @@ -2081,7 +2087,10 @@ cygwin_rexec (char **ahost, unsigned short inport, char *locuser, if (res_fd >= 0) fh = fdsock (res_fd, "/dev/tcp", res); if (fh) - res = res_fd; + { + fh->set_connect_state (CONNECTED); + res = res_fd; + } else { closesocket (res); @@ -2096,7 +2105,10 @@ cygwin_rexec (char **ahost, unsigned short inport, char *locuser, if (newfd >= 0) fh = fdsock (newfd, "/dev/tcp", fd2s); if (fh) - *fd2p = newfd; + { + fh->set_connect_state (CONNECTED); + *fd2p = newfd; + } else { closesocket (res); @@ -2272,6 +2284,7 @@ socketpair (int family, int type, int protocol, int *sb) fh->set_sun_path (""); fh->set_addr_family (family); fh->set_socket_type (type); + fh->set_connect_state (CONNECTED); cygheap_fdnew sb1 (sb0, false); @@ -2283,6 +2296,7 @@ socketpair (int family, int type, int protocol, int *sb) fh->set_sun_path (""); fh->set_addr_family (family); fh->set_socket_type (type); + fh->set_connect_state (CONNECTED); sb[0] = sb0; sb[1] = sb1; |