[vlc-devel] [PATCH] smb2: fix teardown when interrupted

Thomas Guillem thomas at gllm.fr
Wed Aug 21 09:34:25 CEST 2019



On Sun, Aug 18, 2019, at 10:45, Rémi Denis-Courmont wrote:
> Le torstaina 8. elokuuta 2019, 16.00.43 EEST Thomas Guillem a écrit :
> > When the input is stopped by the user, there are lot of chances that this
> > access is waiting for the read command completion (smb2_read_async()).
> 
> Well it should not. Stop means stop. You can (try to) send tear down messages, 
> and you may process any pending message in receive buffers, but that's all. If 
> you are in the middle of a complex transaction, then just drop the TCP session 
> and be done with it.
> 
> That has to work anyway, since the server has to handle the case of VLC 
> crashing or the network connection failing.

Yes, every servers handle that case. But maybe, they can flag the client as "crashing" if they always close the socket without closing the file first.

> 
> This "fix" looks rather like adding a bug where there was none.
> 
> > +#define TEARDOWN_TIMEOUT 250 /* in ms */
> 
> Like no? The teardown timeout is 0.

Why ? Without a timeout, we don't let enough time to close the session ?

> 
> > @@ -159,11 +162,27 @@ vlc_smb2_mainloop(stream_t *access, bool teardown)
> >          if (p_fds[0].fd == -1 || (ret = poll_func(p_fds, 1, timeout)) < 0)
> >          {
> >              if (errno == EINTR)
> > +            {
> >                  msg_Warn(access, "vlc_poll_i11e interrupted");
> > +                if (poll_func != (void *) poll)
> > +                {
> > +                    /* Try again with a timeout to let the command
> > complete. +                     * Indeed, if this command is interrupted,
> > every future +                     * commands will fail and we won't be
> > able to teardown. */ +                    timeout = TEARDOWN_TIMEOUT;
> > +                    poll_func = (void *) poll;
> 
> And that's either a useless or invalid cast.

int vlc_poll_i11e(struct pollfd *fds, unsigned nfds, int timeout);
int poll(struct pollfd *fds, nfds_t nfds, int timeout);

on x86_64:
typedef unsigned long int nfds_t;

Maybe, vlc_poll_i11e should use nfds_t too.

> 
> -- 
> Реми Дёни-Курмон
> http://www.remlab.net/
> 
> 
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list