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

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

Issue 683113005: Update from chromium https://crrev.com/302282 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef NET_TOOLS_FLIP_SERVER_ACCEPTOR_THREAD_H_ 5 #ifndef NET_TOOLS_FLIP_SERVER_ACCEPTOR_THREAD_H_
6 #define NET_TOOLS_FLIP_SERVER_ACCEPTOR_THREAD_H_ 6 #define NET_TOOLS_FLIP_SERVER_ACCEPTOR_THREAD_H_
7 7
8 #include <list> 8 #include <list>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 29 matching lines...) Expand all
40 } 40 }
41 bool value_; 41 bool value_;
42 base::Lock lock_; 42 base::Lock lock_;
43 }; 43 };
44 44
45 class SMAcceptorThread : public base::SimpleThread, 45 class SMAcceptorThread : public base::SimpleThread,
46 public EpollCallbackInterface, 46 public EpollCallbackInterface,
47 public SMConnectionPoolInterface { 47 public SMConnectionPoolInterface {
48 public: 48 public:
49 SMAcceptorThread(FlipAcceptor* acceptor, MemoryCache* memory_cache); 49 SMAcceptorThread(FlipAcceptor* acceptor, MemoryCache* memory_cache);
50 virtual ~SMAcceptorThread(); 50 ~SMAcceptorThread() override;
51 51
52 // EpollCallbackInteface interface 52 // EpollCallbackInteface interface
53 virtual void OnRegistration(EpollServer* eps, 53 void OnRegistration(EpollServer* eps, int fd, int event_mask) override {}
54 int fd, 54 void OnModification(int fd, int event_mask) override {}
55 int event_mask) override {} 55 void OnEvent(int fd, EpollEvent* event) override;
56 virtual void OnModification(int fd, int event_mask) override {} 56 void OnUnregistration(int fd, bool replaced) override {}
57 virtual void OnEvent(int fd, EpollEvent* event) override; 57 void OnShutdown(EpollServer* eps, int fd) override {}
58 virtual void OnUnregistration(int fd, bool replaced) override {}
59 virtual void OnShutdown(EpollServer* eps, int fd) override {}
60 58
61 // SMConnectionPool interface 59 // SMConnectionPool interface
62 virtual void SMConnectionDone(SMConnection* sc) override; 60 void SMConnectionDone(SMConnection* sc) override;
63 61
64 // TODO(mbelshe): figure out if we can move these to private functions. 62 // TODO(mbelshe): figure out if we can move these to private functions.
65 SMConnection* NewConnection(); 63 SMConnection* NewConnection();
66 SMConnection* FindOrMakeNewSMConnection(); 64 SMConnection* FindOrMakeNewSMConnection();
67 void InitWorker(); 65 void InitWorker();
68 void HandleConnection(int server_fd, struct sockaddr_in* remote_addr); 66 void HandleConnection(int server_fd, struct sockaddr_in* remote_addr);
69 void AcceptFromListenFD(); 67 void AcceptFromListenFD();
70 68
71 // Notify the Accept thread that it is time to terminate. 69 // Notify the Accept thread that it is time to terminate.
72 void Quit() { quitting_.Notify(); } 70 void Quit() { quitting_.Notify(); }
73 71
74 // Iterates through a list of active connections expiring any that have been 72 // Iterates through a list of active connections expiring any that have been
75 // idle longer than the configured timeout. 73 // idle longer than the configured timeout.
76 void HandleConnectionIdleTimeout(); 74 void HandleConnectionIdleTimeout();
77 75
78 virtual void Run() override; 76 void Run() override;
79 77
80 private: 78 private:
81 EpollServer epoll_server_; 79 EpollServer epoll_server_;
82 FlipAcceptor* acceptor_; 80 FlipAcceptor* acceptor_;
83 SSLState* ssl_state_; 81 SSLState* ssl_state_;
84 bool use_ssl_; 82 bool use_ssl_;
85 int idle_socket_timeout_s_; 83 int idle_socket_timeout_s_;
86 84
87 std::vector<SMConnection*> unused_server_connections_; 85 std::vector<SMConnection*> unused_server_connections_;
88 std::vector<SMConnection*> tmp_unused_server_connections_; 86 std::vector<SMConnection*> tmp_unused_server_connections_;
89 std::vector<SMConnection*> allocated_server_connections_; 87 std::vector<SMConnection*> allocated_server_connections_;
90 std::list<SMConnection*> active_server_connections_; 88 std::list<SMConnection*> active_server_connections_;
91 Notification quitting_; 89 Notification quitting_;
92 MemoryCache* memory_cache_; 90 MemoryCache* memory_cache_;
93 }; 91 };
94 92
95 } // namespace net 93 } // namespace net
96 94
97 #endif // NET_TOOLS_FLIP_SERVER_ACCEPTOR_THREAD_H_ 95 #endif // NET_TOOLS_FLIP_SERVER_ACCEPTOR_THREAD_H_
OLDNEW
« no previous file with comments | « net/tools/epoll_server/epoll_server.cc ('k') | net/tools/flip_server/flip_in_mem_edsm_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698