This is the mail archive of the
cygwin-developers@cygwin.com
mailing list for the Cygwin project.
PLEASE TEST: New implementation of blocking socket I/O
- From: Corinna Vinschen <vinschen at redhat dot com>
- To: cygwin-developers at cygwin dot com
- Date: Mon, 29 Mar 2004 22:00:59 +0200
- Subject: PLEASE TEST: New implementation of blocking socket I/O
- Reply-to: cygwin-developers at cygwin dot com
Hi,
I've just applied a change of blocking socket read/write. The old
implementation using overlapped I/O was apparently racy, see
http://cygwin.com/ml/cygwin/2004-03/msg01446.html The problem is
the need to call CancelIo if a signal arrived.
The new implementation uses asynchronous I/O now. You can see the core
of the new implementation in the wsock_event class in net.cc.
Basically an event object is created and the approriate network events
are selected for the event (wsock_event::prepare). Then the implementation
differs, depending on being in a recv or send. In case of recvfrom and
recvmsg, wsock_event::wait waits for a FD_CLOSE or FD_READ arriving.
Since FD_CLOSE can arrive before all data has been read in case of
asynchronous I/O, the close event sets a flag in fhandler_socket (2nd
argument to wsock_event::wait), so that all remaining recv calls are
executed w/o using async I/O. Analyzing the sendto and sendmsg cases
is left as an exercise for the reader. It's all pretty straightforward.
PLEASE give the new code a thorough test. I checked operation with
ssh, scp, ftp and lynx so far but I'm of course not sure if I met
all border conditions.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Developer mailto:cygwin@cygwin.com
Red Hat, Inc.