projects
/
cubemap
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
20e85bd
)
When doing persistent connections, explicitly flush the socket so that we do not...
author
Steinar H. Gunderson
<sgunderson@bigfoot.com>
Sat, 7 Apr 2018 00:58:10 +0000
(
02:58
+0200)
committer
Steinar H. Gunderson
<sgunderson@bigfoot.com>
Sat, 7 Apr 2018 00:58:10 +0000
(
02:58
+0200)
server.cpp
patch
|
blob
|
history
diff --git
a/server.cpp
b/server.cpp
index
e9bc654
..
a7f579c
100644
(file)
--- a/
server.cpp
+++ b/
server.cpp
@@
-1,6
+1,7
@@
#include <assert.h>
#include <errno.h>
#include <netinet/in.h>
#include <assert.h>
#include <errno.h>
#include <netinet/in.h>
+#include <netinet/tcp.h>
#include <pthread.h>
#include <stdint.h>
#include <stdio.h>
#include <pthread.h>
#include <stdint.h>
#include <stdio.h>
@@
-1247,6
+1248,14
@@
bool Server::more_requests(Client *client)
// Log to access_log.
access_log->write(client->get_stats());
// Log to access_log.
access_log->write(client->get_stats());
+ // Flush pending data; does not cancel out TCP_CORK (since that still takes priority),
+ // but does a one-off flush.
+ int one = 1;
+ if (setsockopt(client->sock, SOL_TCP, TCP_NODELAY, &one, sizeof(one)) == -1) {
+ log_perror("setsockopt(TCP_NODELAY)");
+ // Can still continue.
+ }
+
// Switch states and reset the parsers. We don't reset statistics.
client->state = Client::READING_REQUEST;
client->url.clear();
// Switch states and reset the parsers. We don't reset statistics.
client->state = Client::READING_REQUEST;
client->url.clear();