[alsa-devel] [PATCH - seq 1/1] ALSA: seq: Continue broadcasting events to ports if one of them fails

Adam Goode agoode at google.com
Wed Jun 4 00:33:32 CEST 2014


On Tue, Jun 3, 2014 at 1:42 AM, Takashi Iwai <tiwai at suse.de> wrote:

> At Mon,  2 Jun 2014 15:41:22 -0400,
> Adam Goode wrote:
> >
> > Sometimes PORT_EXIT messages are lost when a process is exiting.
> > This happens if you subscribe to the announce port with client A,
> > then subscribe to the announce port with client B, then kill client A.
> > Client B will not see the PORT_EXIT message because client A's port is
> > closing and is earlier in the announce port subscription list. The
> > for each loop will try to send the announcement to client A and fail,
> > then will stop trying to broadcast to other ports. Killing B works fine
> > since the announcement will already have gone to A. The CLIENT_EXIT
> > message does not get lost.
> >
> > How to reproduce problem:
> >
> > *** termA
> > $ aseqdump -p 0:1
> >   0:1   Port subscribed            0:1 -> 128:0
> >
> > *** termB
> > $ aseqdump -p 0:1
> >
> > *** termA
> >   0:1   Client start               client 129
> >   0:1   Port start                 129:0
> >   0:1   Port subscribed            0:1 -> 129:0
> >
> > *** termB
> >   0:1   Port subscribed            0:1 -> 129:0
> >
> > *** termA
> > ^C
> >
> > *** termB
> >   0:1   Client exit                client 128
> >    <--- expected Port exit as well (before client exit)
> >
> > Signed-off-by: Adam Goode <agoode at google.com>
>
> Thanks.  The changes look OK to me, though, I'd prefer a variable name
> "result" instead of "sticky_err".  And you don't have to initialize
> err any longer there.
>
> Meanwhile, it's another question what to be returned from the
> function.  Such broadcasting case, would it be better to return always
> num_ev when it's positive, or always report any (non-serious) error?
>
>
Thanks, I will send another patch with "result" instead.

Right now, the function will always report an error if any error occurs. My
patch should not change this behavior. I believe my patch has the effect
equivalent to sorting the list such that the failed ports are all at the
end.

If you would like to change the behavior of the function, that is another
issue.


Thanks,

Adam


More information about the Alsa-devel mailing list