* [FFmpeg-devel] [PATCH] libavformat/tls_libtls: handle TLS_WANT_{POLLIN, POLLOUT} in read/write functions
@ 2022-05-23 10:44 Matthieu Bouron
2022-05-30 14:58 ` Matthieu Bouron
0 siblings, 1 reply; 3+ messages in thread
From: Matthieu Bouron @ 2022-05-23 10:44 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Matthieu Bouron
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)
---
libavformat/tls_libtls.c | 4 ++++
1 file changed, 4 insertions(+)
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);
}
--
2.36.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH] libavformat/tls_libtls: handle TLS_WANT_{POLLIN, POLLOUT} in read/write functions
2022-05-23 10:44 [FFmpeg-devel] [PATCH] libavformat/tls_libtls: handle TLS_WANT_{POLLIN, POLLOUT} in read/write functions Matthieu Bouron
@ 2022-05-30 14:58 ` Matthieu Bouron
2022-06-08 21:16 ` Marton Balint
0 siblings, 1 reply; 3+ messages in thread
From: Matthieu Bouron @ 2022-05-30 14:58 UTC (permalink / raw)
To: ffmpeg-devel
On Mon, May 23, 2022 at 12:44:33PM +0200, Matthieu Bouron wrote:
> 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)
> ---
> libavformat/tls_libtls.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> 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);
> }
> --
Ping.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH] libavformat/tls_libtls: handle TLS_WANT_{POLLIN, POLLOUT} in read/write functions
2022-05-30 14:58 ` Matthieu Bouron
@ 2022-06-08 21:16 ` Marton Balint
0 siblings, 0 replies; 3+ messages in thread
From: Marton Balint @ 2022-06-08 21:16 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Mon, 30 May 2022, Matthieu Bouron wrote:
> On Mon, May 23, 2022 at 12:44:33PM +0200, Matthieu Bouron wrote:
>> 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)
>> ---
>> libavformat/tls_libtls.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> 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);
>> }
>> --
>
> Ping.
Thanks, applied.
Regards,
Marton
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-08 21:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-23 10:44 [FFmpeg-devel] [PATCH] libavformat/tls_libtls: handle TLS_WANT_{POLLIN, POLLOUT} in read/write functions Matthieu Bouron
2022-05-30 14:58 ` Matthieu Bouron
2022-06-08 21:16 ` Marton Balint
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git