| OLD | NEW |
| 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/server/http_server.h" | 5 #include "net/server/http_server.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // connection. Instead of referencing connection with ID all the time, | 116 // connection. Instead of referencing connection with ID all the time, |
| 117 // destroys the connection in next run loop to make sure any pending | 117 // destroys the connection in next run loop to make sure any pending |
| 118 // callbacks in the call stack return. | 118 // callbacks in the call stack return. |
| 119 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, connection); | 119 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, connection); |
| 120 } | 120 } |
| 121 | 121 |
| 122 int HttpServer::GetLocalAddress(IPEndPoint* address) { | 122 int HttpServer::GetLocalAddress(IPEndPoint* address) { |
| 123 return server_socket_->GetLocalAddress(address); | 123 return server_socket_->GetLocalAddress(address); |
| 124 } | 124 } |
| 125 | 125 |
| 126 void HttpServer::SetReceiveBufferSize(int connection_id, int32 size) { | 126 void HttpServer::SetReceiveBufferSize(int connection_id, int32_t size) { |
| 127 HttpConnection* connection = FindConnection(connection_id); | 127 HttpConnection* connection = FindConnection(connection_id); |
| 128 if (connection) | 128 if (connection) |
| 129 connection->read_buf()->set_max_buffer_size(size); | 129 connection->read_buf()->set_max_buffer_size(size); |
| 130 } | 130 } |
| 131 | 131 |
| 132 void HttpServer::SetSendBufferSize(int connection_id, int32 size) { | 132 void HttpServer::SetSendBufferSize(int connection_id, int32_t size) { |
| 133 HttpConnection* connection = FindConnection(connection_id); | 133 HttpConnection* connection = FindConnection(connection_id); |
| 134 if (connection) | 134 if (connection) |
| 135 connection->write_buf()->set_max_buffer_size(size); | 135 connection->write_buf()->set_max_buffer_size(size); |
| 136 } | 136 } |
| 137 | 137 |
| 138 void HttpServer::DoAcceptLoop() { | 138 void HttpServer::DoAcceptLoop() { |
| 139 int rv; | 139 int rv; |
| 140 do { | 140 do { |
| 141 rv = server_socket_->Accept(&accepted_socket_, | 141 rv = server_socket_->Accept(&accepted_socket_, |
| 142 base::Bind(&HttpServer::OnAcceptCompleted, | 142 base::Bind(&HttpServer::OnAcceptCompleted, |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 | 459 |
| 460 // This is called after any delegate callbacks are called to check if Close() | 460 // This is called after any delegate callbacks are called to check if Close() |
| 461 // has been called during callback processing. Using the pointer of connection, | 461 // has been called during callback processing. Using the pointer of connection, |
| 462 // |connection| is safe here because Close() deletes the connection in next run | 462 // |connection| is safe here because Close() deletes the connection in next run |
| 463 // loop. | 463 // loop. |
| 464 bool HttpServer::HasClosedConnection(HttpConnection* connection) { | 464 bool HttpServer::HasClosedConnection(HttpConnection* connection) { |
| 465 return FindConnection(connection->id()) != connection; | 465 return FindConnection(connection->id()) != connection; |
| 466 } | 466 } |
| 467 | 467 |
| 468 } // namespace net | 468 } // namespace net |
| OLD | NEW |