[vlc-commits] smb2: prevent next module probe when possible
Thomas Guillem
git at videolan.org
Thu Oct 31 15:54:38 CET 2019
vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Oct 25 10:53:10 2019 +0200| [5046dde37c43f66e287737762f75b30a177ad5dd] | committer: Thomas Guillem
smb2: prevent next module probe when possible
(cherry picked from commit 83e2c8c90e7b9220d21532827ed9690d23136332)
Signed-off-by: Thomas Guillem <thomas at gllm.fr>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=5046dde37c43f66e287737762f75b30a177ad5dd
---
modules/access/smb2.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/modules/access/smb2.c b/modules/access/smb2.c
index 91483470fd..d86e73166e 100644
--- a/modules/access/smb2.c
+++ b/modules/access/smb2.c
@@ -499,10 +499,11 @@ vlc_smb2_open_share(stream_t *access, const struct smb2_url *smb2_url,
smb2_set_password(sys->smb2, password);
smb2_set_domain(sys->smb2, domain ? domain : "");
- if (smb2_connect_share_async(sys->smb2, smb2_url->server, share,
- username, smb2_generic_cb, access) < 0)
+ int err = smb2_connect_share_async(sys->smb2, smb2_url->server, share,
+ username, smb2_generic_cb, access);
+ if (err < 0)
{
- VLC_SMB2_SET_ERROR(access, "smb2_connect_share_async", 1);
+ VLC_SMB2_SET_ERROR(access, "smb2_connect_share_async", err);
goto error;
}
if (vlc_smb2_mainloop(access, false) != 0)
@@ -727,7 +728,14 @@ error:
}
vlc_UrlClean(&sys->encoded_url);
free(var_domain);
- return VLC_EGENERIC;
+
+ /* Returning VLC_ETIMEOUT will stop the module probe and prevent to load
+ * the next smb module. The smb2 module can return this specific error in
+ * case of network error (EIO) or when the user asked to cancel it
+ * (vlc_killed()). Indeed, in these cases, it is useless to try next smb
+ * modules. */
+ return vlc_killed() || sys->error_status == -EIO ? VLC_ETIMEOUT
+ : VLC_EGENERIC;
}
static void
More information about the vlc-commits
mailing list