[FFmpeg-devel] ff_connect_parallel: do not fail when getsockopt(SO_ERROR) returns EISCONN

Submitted by Peter Ross on Nov. 29, 2018, 8:29 a.m.

Details

Message ID a22f7923f7103a098e48a994f093fcc18bf20b79.1543479909.git.pross@xvid.org
State New
Headers show

Commit Message

Peter Ross Nov. 29, 2018, 8:29 a.m.
for O_NONBLOCK connect(), the watt32 socket library returns EISCONN when connection is established
---

watt32 is a DOS/Windows BSD socket library.

it seems iOS suffers this EISCON problem too, but i am unsure why it hasn't been reported here before.
i don't have iOS device to test.
https://github.com/warmcat/libwebsockets/issues/17


 libavformat/network.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/libavformat/network.c b/libavformat/network.c
index 5664455d18..783de34a98 100644
--- a/libavformat/network.c
+++ b/libavformat/network.c
@@ -475,7 +475,7 @@  int ff_connect_parallel(struct addrinfo *addrs, int timeout_ms_per_address,
                     last_err = ff_neterrno();
                 else if (last_err != 0)
                     last_err = AVERROR(last_err);
-                if (last_err == 0) {
+                if (last_err == 0 || last_err == AVERROR(EISCONN)) {
                     // Everything is ok, we seem to have a successful
                     // connection. Close other sockets and return this one.
                     for (j = 0; j < nb_attempts; j++)