From 814c56413dc1656d16bda75614e7b5c4fbbbcb9a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Fri, 5 Mar 2010 22:38:48 +0000
Subject: [PATCH] Don't explicitly initialize networking in the tcp and udp
 protocols

Networking is always initialized when opening protocols.

Originally committed as revision 22227 to svn://svn.ffmpeg.org/ffmpeg/trunk
---
 libavformat/tcp.c | 4 ----
 libavformat/udp.c | 4 ----
 2 files changed, 8 deletions(-)

diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index a8cf80fbffd..0f097d0dd2c 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -44,9 +44,6 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
     char hostname[1024],proto[1024],path[1024];
     char portstr[10];
 
-    if(!ff_network_init())
-        return AVERROR(EIO);
-
     url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname),
         &port, path, sizeof(path), uri);
     if (strcmp(proto,"tcp") || port <= 0 || port >= 65536)
@@ -192,7 +189,6 @@ static int tcp_close(URLContext *h)
 {
     TCPContext *s = h->priv_data;
     closesocket(s->fd);
-    ff_network_close();
     av_free(s);
     return 0;
 }
diff --git a/libavformat/udp.c b/libavformat/udp.c
index c548014af16..1b09457a461 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -320,9 +320,6 @@ static int udp_open(URLContext *h, const char *uri, int flags)
 
     is_output = (flags & URL_WRONLY);
 
-    if(!ff_network_init())
-        return AVERROR(EIO);
-
     s = av_mallocz(sizeof(UDPContext));
     if (!s)
         return AVERROR(ENOMEM);
@@ -482,7 +479,6 @@ static int udp_close(URLContext *h)
     if (s->is_multicast && !(h->flags & URL_WRONLY))
         udp_leave_multicast_group(s->udp_fd, (struct sockaddr *)&s->dest_addr);
     closesocket(s->udp_fd);
-    ff_network_close();
     av_free(s);
     return 0;
 }
-- 
GitLab