OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <netinet/in.h> | 7 #include <netinet/in.h> |
8 #include <netinet/tcp.h> // For TCP_NODELAY | 8 #include <netinet/tcp.h> // For TCP_NODELAY |
9 #include <sys/socket.h> | 9 #include <sys/socket.h> |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 int on = 1; | 85 int on = 1; |
86 int rc; | 86 int rc; |
87 if (acceptor_->disable_nagle_) { | 87 if (acceptor_->disable_nagle_) { |
88 rc = setsockopt(server_fd, IPPROTO_TCP, TCP_NODELAY, | 88 rc = setsockopt(server_fd, IPPROTO_TCP, TCP_NODELAY, |
89 reinterpret_cast<char*>(&on), sizeof(on)); | 89 reinterpret_cast<char*>(&on), sizeof(on)); |
90 if (rc < 0) { | 90 if (rc < 0) { |
91 close(server_fd); | 91 close(server_fd); |
92 LOG(ERROR) << "setsockopt() failed fd=" + server_fd; | 92 LOG(ERROR) << "setsockopt() failed fd=" << server_fd; |
93 return; | 93 return; |
94 } | 94 } |
95 } | 95 } |
96 | 96 |
97 SMConnection* server_connection = FindOrMakeNewSMConnection(); | 97 SMConnection* server_connection = FindOrMakeNewSMConnection(); |
98 if (server_connection == NULL) { | 98 if (server_connection == NULL) { |
99 VLOG(1) << ACCEPTOR_CLIENT_IDENT << "Acceptor: Closing fd " << server_fd; | 99 VLOG(1) << ACCEPTOR_CLIENT_IDENT << "Acceptor: Closing fd " << server_fd; |
100 close(server_fd); | 100 close(server_fd); |
101 return; | 101 return; |
102 } | 102 } |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 } | 201 } |
202 | 202 |
203 void SMAcceptorThread::SMConnectionDone(SMConnection* sc) { | 203 void SMAcceptorThread::SMConnectionDone(SMConnection* sc) { |
204 VLOG(1) << ACCEPTOR_CLIENT_IDENT << "Done with connection."; | 204 VLOG(1) << ACCEPTOR_CLIENT_IDENT << "Done with connection."; |
205 tmp_unused_server_connections_.push_back(sc); | 205 tmp_unused_server_connections_.push_back(sc); |
206 } | 206 } |
207 | 207 |
208 } // namespace net | 208 } // namespace net |
209 | 209 |
210 | 210 |
OLD | NEW |