public inbox for cygwin-developers@cygwin.com
 help / color / mirror / Atom feed
* AF_UNIX shutdown
@ 2020-10-16 12:55 Ken Brown
  2020-10-16 14:16 ` Ken Brown
  2020-10-19 11:48 ` Corinna Vinschen
  0 siblings, 2 replies; 4+ messages in thread
From: Ken Brown @ 2020-10-16 12:55 UTC (permalink / raw)
  To: cygwin-devel

Hi Corinna,

I'm about to add some code to handle shutdown info, and I want to make sure that 
I understand how this is supposed to work.  fhandler_socket_unix::shutdown 
contains the following comment:

/* Send shutdown info to peer.  Note that it's not necessarily fatal
    if the info isn't sent here.  The info will be reproduced by any
    followup package sent to the peer. */

Does that mean that sendmsg should send its shutdown state as part of every 
packet it sends?

And I guess recvmsg should call grab_admin_pkg at every opportunity and should 
also check the shutdown state in every regular packet it reads?

Thanks.

Ken

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: AF_UNIX shutdown
  2020-10-16 12:55 AF_UNIX shutdown Ken Brown
@ 2020-10-16 14:16 ` Ken Brown
  2020-10-19 11:49   ` Corinna Vinschen
  2020-10-19 11:48 ` Corinna Vinschen
  1 sibling, 1 reply; 4+ messages in thread
From: Ken Brown @ 2020-10-16 14:16 UTC (permalink / raw)
  To: cygwin-developers

On 10/16/2020 8:55 AM, Ken Brown via Cygwin-developers wrote:
> Hi Corinna,
> 
> I'm about to add some code to handle shutdown info, and I want to make sure that 
> I understand how this is supposed to work.  fhandler_socket_unix::shutdown 
> contains the following comment:
> 
> /* Send shutdown info to peer.  Note that it's not necessarily fatal
>     if the info isn't sent here.  The info will be reproduced by any
>     followup package sent to the peer. */
> 
> Does that mean that sendmsg should send its shutdown state as part of every 
> packet it sends?
> 
> And I guess recvmsg should call grab_admin_pkg at every opportunity and should 
> also check the shutdown state in every regular packet it reads?

Another question:

sendmsg currently returns ESHUTDOWN if the socket has been shut down.  Shouldn't 
this be EPIPE? See https://man7.org/linux/man-pages/man2/sendmsg.2.html.

Ken

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: AF_UNIX shutdown
  2020-10-16 12:55 AF_UNIX shutdown Ken Brown
  2020-10-16 14:16 ` Ken Brown
@ 2020-10-19 11:48 ` Corinna Vinschen
  1 sibling, 0 replies; 4+ messages in thread
From: Corinna Vinschen @ 2020-10-19 11:48 UTC (permalink / raw)
  To: cygwin-developers

On Oct 16 08:55, Ken Brown via Cygwin-developers wrote:
> Hi Corinna,
> 
> I'm about to add some code to handle shutdown info, and I want to make sure
> that I understand how this is supposed to work.
> fhandler_socket_unix::shutdown contains the following comment:
> 
> /* Send shutdown info to peer.  Note that it's not necessarily fatal
>    if the info isn't sent here.  The info will be reproduced by any
>    followup package sent to the peer. */
> 
> Does that mean that sendmsg should send its shutdown state as part of every
> packet it sends?

That was the idea.  The shutdown info is part of the package header in
af_unix_pkt_hdr_t, so every newly constructed follow up package contains
the shutdown info "for free".

> And I guess recvmsg should call grab_admin_pkg at every opportunity and
> should also check the shutdown state in every regular packet it reads?

That would make sense, I guess.


Corinna

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: AF_UNIX shutdown
  2020-10-16 14:16 ` Ken Brown
@ 2020-10-19 11:49   ` Corinna Vinschen
  0 siblings, 0 replies; 4+ messages in thread
From: Corinna Vinschen @ 2020-10-19 11:49 UTC (permalink / raw)
  To: cygwin-developers

On Oct 16 10:16, Ken Brown via Cygwin-developers wrote:
> On 10/16/2020 8:55 AM, Ken Brown via Cygwin-developers wrote:
> > Hi Corinna,
> > 
> > I'm about to add some code to handle shutdown info, and I want to make
> > sure that I understand how this is supposed to work. 
> > fhandler_socket_unix::shutdown contains the following comment:
> > 
> > /* Send shutdown info to peer.  Note that it's not necessarily fatal
> >     if the info isn't sent here.  The info will be reproduced by any
> >     followup package sent to the peer. */
> > 
> > Does that mean that sendmsg should send its shutdown state as part of
> > every packet it sends?
> > 
> > And I guess recvmsg should call grab_admin_pkg at every opportunity and
> > should also check the shutdown state in every regular packet it reads?
> 
> Another question:
> 
> sendmsg currently returns ESHUTDOWN if the socket has been shut down.
> Shouldn't this be EPIPE? See
> https://man7.org/linux/man-pages/man2/sendmsg.2.html.

Right, looks like I screwed that up.  Thanks for catching.


Corinna

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-19 11:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-16 12:55 AF_UNIX shutdown Ken Brown
2020-10-16 14:16 ` Ken Brown
2020-10-19 11:49   ` Corinna Vinschen
2020-10-19 11:48 ` Corinna Vinschen

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).