Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: net/tools/flip_server/acceptor_thread.cc

Issue 1744153003: Revert of net: merge two versions of SetTCPNoDelay() function into one (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/socket/tcp_socket_win.cc ('k') | net/tools/flip_server/tcp_socket_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/tools/flip_server/acceptor_thread.h" 5 #include "net/tools/flip_server/acceptor_thread.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <netinet/in.h> 8 #include <netinet/in.h>
9 #include <string.h> // For strerror 9 #include <string.h> // For strerror
10 #include <sys/socket.h> 10 #include <sys/socket.h>
11 #include <sys/types.h> 11 #include <sys/types.h>
12 12
13 #include <string> 13 #include <string>
14 14
15 #include "net/socket/tcp_socket.h"
16 #include "net/tools/flip_server/constants.h" 15 #include "net/tools/flip_server/constants.h"
17 #include "net/tools/flip_server/flip_config.h" 16 #include "net/tools/flip_server/flip_config.h"
18 #include "net/tools/flip_server/sm_connection.h" 17 #include "net/tools/flip_server/sm_connection.h"
19 #include "net/tools/flip_server/spdy_ssl.h" 18 #include "net/tools/flip_server/spdy_ssl.h"
19 #include "net/tools/flip_server/tcp_socket_util.h"
20 #include "openssl/err.h" 20 #include "openssl/err.h"
21 #include "openssl/ssl.h" 21 #include "openssl/ssl.h"
22 22
23 namespace net { 23 namespace net {
24 24
25 SMAcceptorThread::SMAcceptorThread(FlipAcceptor* acceptor, 25 SMAcceptorThread::SMAcceptorThread(FlipAcceptor* acceptor,
26 MemoryCache* memory_cache) 26 MemoryCache* memory_cache)
27 : SimpleThread("SMAcceptorThread"), 27 : SimpleThread("SMAcceptorThread"),
28 acceptor_(acceptor), 28 acceptor_(acceptor),
29 ssl_state_(NULL), 29 ssl_state_(NULL),
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 return server; 76 return server;
77 } 77 }
78 78
79 void SMAcceptorThread::InitWorker() { 79 void SMAcceptorThread::InitWorker() {
80 epoll_server_.RegisterFD(acceptor_->listen_fd_, this, EPOLLIN | EPOLLET); 80 epoll_server_.RegisterFD(acceptor_->listen_fd_, this, EPOLLIN | EPOLLET);
81 } 81 }
82 82
83 void SMAcceptorThread::HandleConnection(int server_fd, 83 void SMAcceptorThread::HandleConnection(int server_fd,
84 struct sockaddr_in* remote_addr) { 84 struct sockaddr_in* remote_addr) {
85 if (acceptor_->disable_nagle_) { 85 if (acceptor_->disable_nagle_) {
86 if (!SetTCPNoDelay(server_fd, /*no_delay=*/true)) { 86 if (!SetTCPNoDelay(server_fd)) {
87 close(server_fd); 87 close(server_fd);
88 LOG(FATAL) << "SetTCPNoDelay() failed on fd: " << server_fd; 88 LOG(FATAL) << "SetTCPNoDelay() failed on fd: " << server_fd;
89 return; 89 return;
90 } 90 }
91 } 91 }
92 92
93 SMConnection* server_connection = FindOrMakeNewSMConnection(); 93 SMConnection* server_connection = FindOrMakeNewSMConnection();
94 if (server_connection == NULL) { 94 if (server_connection == NULL) {
95 VLOG(1) << ACCEPTOR_CLIENT_IDENT << "Acceptor: Closing fd " << server_fd; 95 VLOG(1) << ACCEPTOR_CLIENT_IDENT << "Acceptor: Closing fd " << server_fd;
96 close(server_fd); 96 close(server_fd);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 AcceptFromListenFD(); 197 AcceptFromListenFD();
198 } 198 }
199 } 199 }
200 200
201 void SMAcceptorThread::SMConnectionDone(SMConnection* sc) { 201 void SMAcceptorThread::SMConnectionDone(SMConnection* sc) {
202 VLOG(1) << ACCEPTOR_CLIENT_IDENT << "Done with connection."; 202 VLOG(1) << ACCEPTOR_CLIENT_IDENT << "Done with connection.";
203 tmp_unused_server_connections_.push_back(sc); 203 tmp_unused_server_connections_.push_back(sc);
204 } 204 }
205 205
206 } // namespace net 206 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/tcp_socket_win.cc ('k') | net/tools/flip_server/tcp_socket_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698