From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id E19625021D for ; Wed, 9 Jul 2025 14:14:01 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 8B94568F765; Wed, 9 Jul 2025 17:13:57 +0300 (EEST) Received: from btbn.de (btbn.de [144.76.60.213]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 81DDA68F759 for ; Wed, 9 Jul 2025 17:13:51 +0300 (EEST) Received: from [authenticated] by btbn.de (Postfix) with ESMTPSA id C30BF27FFCCBE for ; Wed, 09 Jul 2025 16:13:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rothenpieler.org; s=mail; t=1752070430; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gwV9bSBg0vpYVpRFYVOpi6wxxd2+B83L8nQag06MU3g=; b=Xq2Z5cma52OUFsyf4K2THpSw2+nPbI+3QijMQaPR5lkyHM9Up4uAEMFIDHtIb4JdM4qnHZ 9k4CpSRvOSoZLzcYC/ENTmWir5agYxa6nADLtVMxTc5gkgX1sihqo4Q3x2lB0skq4hQX5A CIkEVMJvPb3cRaau6yc5cZIBZou3T36Of6WeNFRIYpfVGt4IhbWFHLRjy7zNkNx3D6bZzn JoDSwckknz+d3FWU4S0zx8vOjBSXFCq+qbCStK9dEYVy67vKREqIw0rDXTEeSbzevaxWO/ T/0pGOEHD5REvHbU+vITeZjlF1YSifufc/5qSHdwCNk2k4UygdwO+RsvVR6gzg== Message-ID: <0a871863-bf8c-4727-bf52-96bf1adb53f8@rothenpieler.org> Date: Wed, 9 Jul 2025 16:14:15 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: ffmpeg-devel@ffmpeg.org References: <20250709133635.22936-1-jacklau1222@qq.com> <20250709133635.22936-3-jacklau1222@qq.com> Content-Language: en-US, de-DE From: Timo Rothenpieler In-Reply-To: <20250709133635.22936-3-jacklau1222@qq.com> Subject: Re: [FFmpeg-devel] [PATCH 2/4] avformat/tls_openssl: fix dtls_handshake return code X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 09/07/2025 15:36, Jack Lau wrote: > If the handshake is still in progress, dtls_handshake should > return a positive status code. Shouldn't dtls_open/start also be calling it in a loop then? I don't think it's expected that you might be needed to call the handshake function in a loop after a urlcontext was successfully opened. What I've done for the schannel implementation is force nonblocking off for the handshake, since there is just no good way to perform it in a nonblocking way, and you just always end up looping until it's done anyway. > Signed-off-by: Jack Lau > --- > libavformat/tls_openssl.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c > index 8639ac9758..ffd9cd51d2 100644 > --- a/libavformat/tls_openssl.c > +++ b/libavformat/tls_openssl.c > @@ -716,15 +716,14 @@ static int openssl_dtls_verify_callback(int preverify_ok, X509_STORE_CTX *ctx) > > static int dtls_handshake(URLContext *h) > { > - int ret = 0, r0, r1; > + int ret = EINPROGRESS, r0, r1; > TLSContext *p = h->priv_data; > > r0 = SSL_do_handshake(p->ssl); > r1 = SSL_get_error(p->ssl, r0); > if (r0 <= 0) { > if (r1 != SSL_ERROR_WANT_READ && r1 != SSL_ERROR_WANT_WRITE && r1 != SSL_ERROR_ZERO_RETURN) { > - av_log(p, AV_LOG_ERROR, "TLS: Read failed, r0=%d, r1=%d %s\n", r0, r1, openssl_get_error(p)); > - ret = AVERROR(EIO); > + ret = print_ssl_error(h, r1); > goto end; > } > } else { > @@ -734,7 +733,7 @@ static int dtls_handshake(URLContext *h) > /* Check whether the DTLS is completed. */ > if (SSL_is_init_finished(p->ssl) != 1) > goto end; > - > + ret = 0; > p->tls_shared.state = DTLS_STATE_FINISHED; > end: > return ret; _______________________________________________ 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".