diff options
author | Matthieu Bouron <matthieu.bouron@gmail.com> | 2022-05-23 12:44:33 +0200 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2022-06-08 23:09:47 +0200 |
commit | 6dd6c58d8976d9c43828af45d7c47ab7f0c983e6 (patch) | |
tree | 93316ef7b1bf61b73583c1c83b4a374828741bf1 /libavformat/tls_libtls.c | |
parent | 830f49cb9dc3b3086d1cd3dab9b1dcebbde9d048 (diff) |
libavformat/tls_libtls: handle TLS_WANT_{POLLIN, POLLOUT} in read/write functions
According to the tls documentation: tls_read() and tls_write() can
return TLS_WANT_POLLIN and TLS_WANT_POLLOUT which indicates that the
same operation must be repeated immediately.
This commit prevents the libtls backend from failing when libtls returns
TLS_WANT_POLLIN or TLS_WANT_POLLOUT with the following error:
[tls @ 0x7f6e20005a00] (null)
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavformat/tls_libtls.c')
-rw-r--r-- | libavformat/tls_libtls.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/tls_libtls.c b/libavformat/tls_libtls.c index 911c8094b0..22858d4867 100644 --- a/libavformat/tls_libtls.c +++ b/libavformat/tls_libtls.c @@ -158,6 +158,8 @@ static int ff_tls_read(URLContext *h, uint8_t *buf, int size) return ret; else if (ret == 0) return AVERROR_EOF; + else if (ret == TLS_WANT_POLLIN || ret == TLS_WANT_POLLOUT) + return AVERROR(EAGAIN); av_log(h, AV_LOG_ERROR, "%s\n", tls_error(p->ctx)); return AVERROR(EIO); } @@ -171,6 +173,8 @@ static int ff_tls_write(URLContext *h, const uint8_t *buf, int size) return ret; else if (ret == 0) return AVERROR_EOF; + else if (ret == TLS_WANT_POLLIN || ret == TLS_WANT_POLLOUT) + return AVERROR(EAGAIN); av_log(h, AV_LOG_ERROR, "%s\n", tls_error(p->ctx)); return AVERROR(EIO); } |