Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Fadecandy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
scanlime
Fadecandy
Commits
0ae6709e
Commit
0ae6709e
authored
11 years ago
by
Micah Elizabeth Scott
Browse files
Options
Downloads
Patches
Plain Diff
Socket options, tcp nodelay & reuseaddr
parent
d7fbe4bd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
server/opcsink.cpp
+8
-0
8 additions, 0 deletions
server/opcsink.cpp
with
8 additions
and
0 deletions
server/opcsink.cpp
+
8
−
0
View file @
0ae6709e
...
...
@@ -27,6 +27,8 @@
#include
<unistd.h>
#include
<string.h>
#include
<arpa/inet.h>
#include
<netinet/in.h>
#include
<netinet/tcp.h>
#include
<iostream>
...
...
@@ -41,6 +43,9 @@ void OPCSink::start(struct ev_loop *loop, struct addrinfo *listenAddr)
return
;
}
int
arg
=
1
;
setsockopt
(
sock
,
SOL_SOCKET
,
SO_REUSEADDR
,
&
arg
,
sizeof
arg
);
if
(
bind
(
sock
,
listenAddr
->
ai_addr
,
listenAddr
->
ai_addrlen
))
{
perror
(
"bind"
);
return
;
...
...
@@ -73,6 +78,9 @@ void OPCSink::cbAccept(struct ev_loop *loop, struct ev_io *watcher, int revents)
return
;
}
int
arg
=
1
;
setsockopt
(
sock
,
IPPROTO_TCP
,
TCP_NODELAY
,
&
arg
,
sizeof
arg
);
Client
*
cli
=
new
Client
();
cli
->
bufferPos
=
0
;
cli
->
self
=
self
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment