From 01e3c89709d01415b3f5a363714104460a4a43e4 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 28 Jan 2003 15:33:50 +0000 Subject: [PATCH] * fhandler_socket.cc (fhandler_socket::accept): On successful execution set connection state of returned socket to CONNECTED. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/fhandler_socket.cc | 31 +++++++++++++++---------------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index a7464a14c..13286903f 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2003-01-28 Corinna Vinschen + + * fhandler_socket.cc (fhandler_socket::accept): On successful execution + set connection state of returned socket to CONNECTED. + 2003-01-27 Christopher Faylor * passwd.cc (pwdgrp::parse_passwd): Be more unforgiving about diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index 30ff64cf9..a3cbdd738 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -484,6 +484,7 @@ fhandler_socket::accept (struct sockaddr *peer, int *len) WSAEVENT ev[2] = { WSA_INVALID_EVENT, signal_arrived }; BOOL secret_check_failed = FALSE; BOOL in_progress = FALSE; + cygheap_fdnew res_fd; /* Allows NULL peer and len parameters. */ struct sockaddr_in peer_dummy; @@ -592,22 +593,20 @@ fhandler_socket::accept (struct sockaddr *peer, int *len) } } - { - cygheap_fdnew res_fd; - if (res_fd < 0) - /* FIXME: what is correct errno? */; - else if ((SOCKET) res == (SOCKET) INVALID_SOCKET) - set_winsock_errno (); - else - { - fhandler_socket* res_fh = fdsock (res_fd, get_name (), res); - if (get_addr_family () == AF_LOCAL) - res_fh->set_sun_path (get_sun_path ()); - res_fh->set_addr_family (get_addr_family ()); - res_fh->set_socket_type (get_socket_type ()); - res = res_fd; - } - } + if (res_fd < 0) + /* FIXME: what is correct errno? */; + else if ((SOCKET) res == (SOCKET) INVALID_SOCKET) + set_winsock_errno (); + else + { + fhandler_socket* res_fh = fdsock (res_fd, get_name (), res); + if (get_addr_family () == AF_LOCAL) + res_fh->set_sun_path (get_sun_path ()); + res_fh->set_addr_family (get_addr_family ()); + res_fh->set_socket_type (get_socket_type ()); + res_fh->set_connect_state (CONNECTED); + res = res_fd; + } done: if (ev[0] != WSA_INVALID_EVENT)