Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-1.1
Commits
f9279bb4
Commit
f9279bb4
authored
Feb 21, 2007
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor code factorization
parent
412ce0dd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
15 deletions
+17
-15
include/vlc_network.h
include/vlc_network.h
+1
-0
src/network/io.c
src/network/io.c
+15
-8
src/network/tcp.c
src/network/tcp.c
+1
-7
No files found.
include/vlc_network.h
View file @
f9279bb4
...
...
@@ -69,6 +69,7 @@ extern "C" {
/* Portable networking layer communication */
int
net_Socket
(
vlc_object_t
*
obj
,
int
family
,
int
socktype
,
int
proto
);
int
net_SetupSocket
(
int
fd
);
#define net_Connect(a, b, c, d, e) __net_Connect(VLC_OBJECT(a), b, c, d, e)
VLC_EXPORT
(
int
,
__net_Connect
,
(
vlc_object_t
*
p_this
,
const
char
*
psz_host
,
int
i_port
,
int
socktype
,
int
protocol
)
);
...
...
src/network/io.c
View file @
f9279bb4
...
...
@@ -67,6 +67,20 @@
extern
int
rootwrap_bind
(
int
family
,
int
socktype
,
int
protocol
,
const
struct
sockaddr
*
addr
,
size_t
alen
);
int
net_SetupSocket
(
int
fd
)
{
#if defined (WIN32) || defined (UNDER_CE)
ioctlsocket
(
fd
,
FIONBIO
,
&
(
unsigned
long
){
1
});
#else
fcntl
(
fd
,
F_SETFD
,
FD_CLOEXEC
);
fcntl
(
fd
,
F_SETFL
,
fcntl
(
fd
,
F_GETFL
,
0
)
|
O_NONBLOCK
);
#endif
setsockopt
(
fd
,
SOL_SOCKET
,
SO_REUSEADDR
,
&
(
int
){
1
},
sizeof
(
int
));
return
0
;
}
int
net_Socket
(
vlc_object_t
*
p_this
,
int
family
,
int
socktype
,
int
protocol
)
{
...
...
@@ -79,14 +93,7 @@ int net_Socket (vlc_object_t *p_this, int family, int socktype,
return
-
1
;
}
#if defined (WIN32) || defined (UNDER_CE)
ioctlsocket
(
fd
,
FIONBIO
,
&
(
unsigned
long
){
1
});
#else
fcntl
(
fd
,
F_SETFD
,
FD_CLOEXEC
);
fcntl
(
fd
,
F_SETFL
,
fcntl
(
fd
,
F_GETFL
,
0
)
|
O_NONBLOCK
);
#endif
setsockopt
(
fd
,
SOL_SOCKET
,
SO_REUSEADDR
,
&
(
int
){
1
},
sizeof
(
int
));
net_SetupSocket
(
fd
);
#ifdef IPV6_V6ONLY
/*
...
...
src/network/tcp.c
View file @
f9279bb4
...
...
@@ -321,13 +321,7 @@ int __net_Accept( vlc_object_t *p_this, int pi_fd[], mtime_t i_wait )
net_strerror
(
net_errno
));
continue
;
}
setsockopt
(
fd
,
SOL_SOCKET
,
SO_REUSEADDR
,
&
(
int
){
1
},
sizeof
(
int
));
#if defined (WIN32) || defined (UNDER_CE)
ioctlsocket
(
fd
,
FIONBIO
,
&
(
unsigned
long
){
1
});
#else
fcntl
(
fd
,
F_SETFD
,
FD_CLOEXEC
);
fcntl
(
fd
,
F_SETFL
,
fcntl
(
fd
,
F_GETFL
,
0
)
|
O_NONBLOCK
);
#endif
net_SetupSocket
(
fd
);
/*
* This round-robin trick ensures that the first sockets in
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment