Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
1f0804bd
Commit
1f0804bd
authored
Dec 30, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
listen: don't make the server socket non-blocking
There is no point in making the server socket non-blocking. We call accept() only after select() has notified us about a new connection.
parent
6890183c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
7 deletions
+1
-7
listen.c
src/listen.c
+1
-7
No files found.
src/listen.c
View file @
1f0804bd
...
@@ -67,11 +67,6 @@ static int establishListen(int pf, const struct sockaddr *addrp,
...
@@ -67,11 +67,6 @@ static int establishListen(int pf, const struct sockaddr *addrp,
if
((
sock
=
socket
(
pf
,
SOCK_STREAM
,
0
))
<
0
)
if
((
sock
=
socket
(
pf
,
SOCK_STREAM
,
0
))
<
0
)
g_error
(
"socket < 0"
);
g_error
(
"socket < 0"
);
if
(
set_nonblocking
(
sock
)
<
0
)
{
g_error
(
"problems setting nonblocking on listen socket: %s"
,
strerror
(
errno
));
}
if
(
setsockopt
(
sock
,
SOL_SOCKET
,
SO_REUSEADDR
,
(
char
*
)
&
allowReuse
,
if
(
setsockopt
(
sock
,
SOL_SOCKET
,
SO_REUSEADDR
,
(
char
*
)
&
allowReuse
,
sizeof
(
allowReuse
))
<
0
)
{
sizeof
(
allowReuse
))
<
0
)
{
g_error
(
"problems setsockopt'ing: %s"
,
strerror
(
errno
));
g_error
(
"problems setsockopt'ing: %s"
,
strerror
(
errno
));
...
@@ -283,8 +278,7 @@ void getConnections(fd_set * fds)
...
@@ -283,8 +278,7 @@ void getConnections(fd_set * fds)
if
((
fd
=
accept
(
listenSockets
[
i
],
&
sockAddr
,
&
socklen
))
if
((
fd
=
accept
(
listenSockets
[
i
],
&
sockAddr
,
&
socklen
))
>=
0
)
{
>=
0
)
{
client_new
(
fd
,
&
sockAddr
,
get_remote_uid
(
fd
));
client_new
(
fd
,
&
sockAddr
,
get_remote_uid
(
fd
));
}
else
if
(
fd
<
0
}
else
if
(
fd
<
0
&&
errno
!=
EINTR
)
{
&&
(
errno
!=
EAGAIN
&&
errno
!=
EINTR
))
{
g_warning
(
"Problems accept()'ing"
);
g_warning
(
"Problems accept()'ing"
);
}
}
}
}
...
...
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