From patchwork Mon Feb 17 00:36:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 17813 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id C792D44AC15 for ; Mon, 17 Feb 2020 02:37:36 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B2D9668A0AE; Mon, 17 Feb 2020 02:37:36 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 20D8668A0A3 for ; Mon, 17 Feb 2020 02:37:35 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id F110EE36B4; Mon, 17 Feb 2020 01:37:34 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oxVMM8JIM5WQ; Mon, 17 Feb 2020 01:37:33 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 769CDE38A5; Mon, 17 Feb 2020 01:37:33 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Mon, 17 Feb 2020 01:36:51 +0100 Message-Id: <20200217003653.20027-7-cus@passwd.hu> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20200217003653.20027-1-cus@passwd.hu> References: <20200213231624.28373-1-cus@passwd.hu> <20200217003653.20027-1-cus@passwd.hu> Subject: [FFmpeg-devel] [PATCH v2 7/9] avformat/libsrt: use listen_timeout for listening X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Cc: Marton Balint MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Marton Balint --- libavformat/libsrt.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c index fe3e7d4207..f24ce46831 100644 --- a/libavformat/libsrt.c +++ b/libavformat/libsrt.c @@ -227,14 +227,9 @@ static int libsrt_listen(int eid, int fd, const struct sockaddr *addr, socklen_t if (ret) return libsrt_neterrno(h); - while ((ret = libsrt_network_wait_fd_timeout(h, eid, fd, 1, timeout, &h->interrupt_callback))) { - switch (ret) { - case AVERROR(ETIMEDOUT): - continue; - default: - return ret; - } - } + ret = libsrt_network_wait_fd_timeout(h, eid, fd, 1, timeout, &h->interrupt_callback); + if (ret < 0) + return ret; ret = srt_accept(fd, NULL, NULL); if (ret < 0) @@ -434,7 +429,7 @@ static int libsrt_setup(URLContext *h, const char *uri, int flags) if (s->mode == SRT_MODE_LISTENER) { // multi-client - if ((ret = libsrt_listen(s->eid, fd, cur_ai->ai_addr, cur_ai->ai_addrlen, h, open_timeout)) < 0) + if ((ret = libsrt_listen(s->eid, fd, cur_ai->ai_addr, cur_ai->ai_addrlen, h, s->listen_timeout)) < 0) goto fail1; fd = ret; } else {