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

Unified Diff: net/tools/flip_server/acceptor_thread.cc

Issue 93793004: Format and Refactor Flip Server. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 7 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/tools/flip_server/acceptor_thread.h ('k') | net/tools/flip_server/constants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/flip_server/acceptor_thread.cc
diff --git a/net/tools/flip_server/acceptor_thread.cc b/net/tools/flip_server/acceptor_thread.cc
index ed8a3ec86f3c344c33a9208e2396ff527551d1f8..5dfece1dedeaad87547e4cb2cc8d540fa345fc35 100644
--- a/net/tools/flip_server/acceptor_thread.cc
+++ b/net/tools/flip_server/acceptor_thread.cc
@@ -20,7 +20,7 @@
namespace net {
-SMAcceptorThread::SMAcceptorThread(FlipAcceptor *acceptor,
+SMAcceptorThread::SMAcceptorThread(FlipAcceptor* acceptor,
MemoryCache* memory_cache)
: SimpleThread("SMAcceptorThread"),
acceptor_(acceptor),
@@ -48,7 +48,7 @@ SMAcceptorThread::SMAcceptorThread(FlipAcceptor *acceptor,
SMAcceptorThread::~SMAcceptorThread() {
for (std::vector<SMConnection*>::iterator i =
- allocated_server_connections_.begin();
+ allocated_server_connections_.begin();
i != allocated_server_connections_.end();
++i) {
delete *i;
@@ -57,10 +57,8 @@ SMAcceptorThread::~SMAcceptorThread() {
}
SMConnection* SMAcceptorThread::NewConnection() {
- SMConnection* server =
- SMConnection::NewSMConnection(&epoll_server_, ssl_state_,
- memory_cache_, acceptor_,
- "client_conn: ");
+ SMConnection* server = SMConnection::NewSMConnection(
+ &epoll_server_, ssl_state_, memory_cache_, acceptor_, "client_conn: ");
allocated_server_connections_.push_back(server);
VLOG(2) << ACCEPTOR_CLIENT_IDENT << "Acceptor: Making new server.";
return server;
@@ -81,12 +79,15 @@ void SMAcceptorThread::InitWorker() {
}
void SMAcceptorThread::HandleConnection(int server_fd,
- struct sockaddr_in *remote_addr) {
+ struct sockaddr_in* remote_addr) {
int on = 1;
int rc;
if (acceptor_->disable_nagle_) {
- rc = setsockopt(server_fd, IPPROTO_TCP, TCP_NODELAY,
- reinterpret_cast<char*>(&on), sizeof(on));
+ rc = setsockopt(server_fd,
+ IPPROTO_TCP,
+ TCP_NODELAY,
+ reinterpret_cast<char*>(&on),
+ sizeof(on));
if (rc < 0) {
close(server_fd);
LOG(ERROR) << "setsockopt() failed fd=" << server_fd;
@@ -128,7 +129,7 @@ void SMAcceptorThread::AcceptFromListenFD() {
break;
}
VLOG(1) << ACCEPTOR_CLIENT_IDENT << " Accepted connection";
- HandleConnection(fd, (struct sockaddr_in *)&address);
+ HandleConnection(fd, (struct sockaddr_in*)&address);
}
} else {
while (true) {
@@ -144,7 +145,7 @@ void SMAcceptorThread::AcceptFromListenFD() {
break;
}
VLOG(1) << ACCEPTOR_CLIENT_IDENT << "Accepted connection";
- HandleConnection(fd, (struct sockaddr_in *)&address);
+ HandleConnection(fd, (struct sockaddr_in*)&address);
}
}
}
@@ -162,7 +163,7 @@ void SMAcceptorThread::HandleConnectionIdleTimeout() {
// is already in-order.
std::list<SMConnection*>::iterator iter = active_server_connections_.begin();
while (iter != active_server_connections_.end()) {
- SMConnection *conn = *iter;
+ SMConnection* conn = *iter;
int elapsed_time = (cur_time - conn->last_read_time_);
if (elapsed_time > idle_socket_timeout_s_) {
conn->Cleanup("Connection idle timeout reached.");
@@ -208,5 +209,3 @@ void SMAcceptorThread::SMConnectionDone(SMConnection* sc) {
}
} // namespace net
-
-
« no previous file with comments | « net/tools/flip_server/acceptor_thread.h ('k') | net/tools/flip_server/constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698