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

Rémi Denis-Courmont remi at remlab.net
Sun Aug 18 10:45:48 CEST 2019


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.

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.

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

-- 
Реми Дёни-Курмон
http://www.remlab.net/





More information about the vlc-devel mailing list