Commit 6dd6c58d authored by Matthieu Bouron's avatar Matthieu Bouron Committed by Marton Balint

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: 's avatarMarton Balint <cus@passwd.hu>
parent 830f49cb
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment