Index: net/web2socket_proxy/web2socket.cc |
diff --git a/net/web2socket_proxy/web2socket.cc b/net/web2socket_proxy/web2socket.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e9d7211bf0375a00a6927fc3a8fed0286fd26f02 |
--- /dev/null |
+++ b/net/web2socket_proxy/web2socket.cc |
@@ -0,0 +1,31 @@ |
+// Copyright (c) 2010 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include <stdlib.h> |
+ |
+#include <sys/wait.h> |
+#include <unistd.h> |
+ |
+#include "web2socket_serv.h" |
+ |
+struct sockaddr; |
+ |
+void RunWeb2SocketServer(const std::string& origin, |
+ struct sockaddr* addr, |
+ int addr_len) { |
+ for (int step = 0;; step += (step < 10)) { |
+ int p = fork(); |
+ if (p == 0) { |
+ if (Web2SocketServ::IgnoreSigPipe()) { |
+ Web2SocketServ ws(origin, addr, addr_len); |
+ ws.Run(); |
+ } |
+ exit(1); |
+ } |
+ if (p > 0) |
+ waitpid(p, NULL, 0); |
+ sleep(1 << step); |
+ } |
+} |
+ |