public inbox for cygwin-developers@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin-developers@cygwin.com
Subject: Re: Problems with the (new) implementation of AF_UNIX datagram sockets
Date: Thu, 15 Apr 2021 15:58:17 +0200	[thread overview]
Message-ID: <YHhGeUDV1t+9/7p1@calimero.vinschen.de> (raw)
In-Reply-To: <af4fd19e-a849-cb2e-7327-7ffc5647c11a@cornell.edu>

On Apr 15 09:16, Ken Brown wrote:
> On 4/15/2021 7:49 AM, Corinna Vinschen wrote:
> > On Apr 14 12:15, Ken Brown wrote:
> [...]
> > > 1. Writing will block until a connection to the peer's pipe can be
> > > made.  In particular, if there are two consecutive writes with the
> > > same peer, the second one will block until the peer reads the
> > > first message.  This happens because the peer's pipe is not
> > > available for the second connection until the peer disconnects the
> > > first connection.  This is currently done in recvmsg,
> > > and I don't see a straightforward way to do it anywhere else.
> > 
> > I'm a bit puzzeled.  The idea for datagrams was to call open/send/close
> > in each invocation of sendmsg.  Therefore the pipe should become
> > available as soon as the other peer has sent it's data block.  The time
> > a sendmsg has to wait for the pipe being available should be quite short!
> 
> Unfortunately, the pipe isn't available until the server disconnects.  I
> observed this in practice, and it's also documented at
> 
> https://docs.microsoft.com/en-us/windows/win32/api/namedpipeapi/nf-namedpipeapi-disconnectnamedpipe
> 
> "The server process must call DisconnectNamedPipe to disconnect a pipe
> handle from its previous client before the handle can be connected to
> another client by using the ConnectNamedPipe function."

d'oh

> [...]
> > Another idea might be to implement send/recv on a DGRAM socket a bit
> > like accept.  Rather than creating a single_instance socket, we create a
> > max_instance socket as for STREAM socket listeners.  The server side
> > accepts the connection at recv and immediately opens another pipe
> > instance, so we always have at least one dangling instance for the next
> > peer.
> 
> I thought about that, but you would still have the problem (as in 1 above)
> that the pipe instance isn't available until recv is called.

There always is at least one instance.  Do you mean, two clients are
trying to send while the server is idly playing with his toes?


Corinna

  reply	other threads:[~2021-04-15 13:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-14 16:15 Ken Brown
2021-04-15 11:49 ` Corinna Vinschen
2021-04-15 13:16   ` Ken Brown
2021-04-15 13:58     ` Corinna Vinschen [this message]
2021-04-15 14:53       ` Ken Brown
2021-04-15 23:50         ` Mark Geisert
2021-04-16  9:37           ` Corinna Vinschen
2021-04-17  2:54             ` Mark Geisert
2021-04-17 16:05               ` Ken Brown
2021-04-19  8:48                 ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YHhGeUDV1t+9/7p1@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin-developers@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).