Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 CHROME_BROWSER_CHROMEOS_WEB_SOCKET_PROXY_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_WEB_SOCKET_PROXY_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_WEB_SOCKET_PROXY_H_ | 6 #define CHROME_BROWSER_CHROMEOS_WEB_SOCKET_PROXY_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 | 12 |
| 13 struct sockaddr; | 13 struct sockaddr; |
| 14 | 14 |
| 15 namespace chromeos { | 15 namespace chromeos { |
| 16 | 16 |
| 17 class WebSocketProxy { | 17 class WebSocketProxy { |
| 18 public: | 18 public: |
| 19 static const size_t kReadBufferLimit = 6 * 1024 * 1024; | 19 static const size_t kReadBufferLimit = 12 * 1024 * 1024; |
| 20 | 20 |
| 21 // Limits incoming websocket headers in initial stage of connection. | 21 // Limits incoming websocket headers in initial stage of connection. |
| 22 static const size_t kHeaderLimit = 32 * 1024; | 22 static const size_t kHeaderLimit = 32 * 1024; |
| 23 | 23 |
| 24 // Limits number of simultaneously open connections. | 24 // Limits number of simultaneously open connections. |
| 25 static const size_t kConnPoolLimit = 1000; | 25 static const size_t kConnPoolLimit = 200; |
|
Dmitry Polukhin
2011/05/17 10:58:39
I think it should be even much smaller 20.
Denis Lagno
2011/05/17 22:15:08
Done.
| |
| 26 | 26 |
| 27 // Empty allowed_origins vector disables check for origin. | |
| 27 WebSocketProxy( | 28 WebSocketProxy( |
| 28 const std::vector<std::string>& allowed_origins, | 29 const std::vector<std::string>& allowed_origins, |
| 29 struct sockaddr* addr, int addr_len); | 30 struct sockaddr* addr, int addr_len); |
| 30 ~WebSocketProxy(); | 31 ~WebSocketProxy(); |
| 31 | 32 |
| 32 // Do not call it twice. | 33 // Do not call it twice. |
| 33 void Run(); | 34 void Run(); |
| 34 | 35 |
| 35 // Terminates running server (should be called on a different thread). | 36 // Terminates running server (should be called on a different thread). |
| 36 void Shutdown(); | 37 void Shutdown(); |
| 37 | 38 |
| 38 private: | 39 private: |
| 39 void* impl_; | 40 void* impl_; |
| 40 | 41 |
| 41 DISALLOW_COPY_AND_ASSIGN(WebSocketProxy); | 42 DISALLOW_COPY_AND_ASSIGN(WebSocketProxy); |
| 42 }; | 43 }; |
| 43 | 44 |
| 44 } // namespace chromeos | 45 } // namespace chromeos |
| 45 | 46 |
| 46 #endif // CHROME_BROWSER_CHROMEOS_WEB_SOCKET_PROXY_H_ | 47 #endif // CHROME_BROWSER_CHROMEOS_WEB_SOCKET_PROXY_H_ |
| OLD | NEW |