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

Side by Side Diff: net/web2socket_proxy/web2socket_serv.h

Issue 5484001: Web2socket proxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: additional files Created 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_WEB2SOCKET_PROXY_WEB2SOCKET_SERV_H_
6 #define CHROME_WEB2SOCKET_PROXY_WEB2SOCKET_SERV_H_
7
8 #include <list>
9 #include <map>
10 #include <stdint.h>
tyoshino (SeeGerritForStatus) 2010/12/03 07:53:33 C system file go first
Denis Lagno 2010/12/03 16:28:50 Done.
11
12 #include "base/basictypes.h"
13 #include "net/web2socket_proxy/web2socket.h"
14
15 class Web2SocketServ {
16 public:
17 Web2SocketServ(const std::string& origin = std::string(),
18 int port = 10101);
19 void Run();
20 ~Web2SocketServ();
21
22 static const size_t kConnPoolLimit = 144;
23 static const size_t kReadBufferLimit = 128 * 1024;
24
25 void ZapConn(struct Conn*);
26 void MarkConnImportance(struct Conn*, bool important);
27 struct Conn* GetFreshConn();
28 bool IsConnSane(struct Conn*);
29
30 static void OnConnect(int listening_sock, short event, void*);
31
32 // Return true on success.
33 static bool SetNonBlock(int fd);
34 static bool IgnoreSigPipe(void);
35
36 // Checked against value of Origin field specified
37 // in a client websocket handshake.
38 std::string origin_;
39
40 // Network port for server to listen incoming websocket connections.
41 int port_;
42
43 // Libevent base.
44 struct event_base* evbase_;
45
46 // Socket to listen incoming websocket connections.
47 int listening_sock_;
48
49 // List of pending connections; We are trying to keep size of this list
50 // below kConnPoolLimit in LRU fashion.
51 typedef std::list<struct Conn*> ConnPool;
52 ConnPool conn_pool_;
53
54 // Reverse map to look up a connection in a conn_pool.
55 typedef std::map<struct Conn*, ConnPool::iterator> RevMap;
56 RevMap rev_map_;
57
58 DISALLOW_COPY_AND_ASSIGN(Web2SocketServ);
59 };
60
61 #endif // CHROME_WEB2SOCKET_PROXY_WEB2SOCKET_SERV_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698