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..16ce7587a0bac70b77aa72f3d64f793637c1095f |
--- /dev/null |
+++ b/net/web2socket_proxy/web2socket.cc |
@@ -0,0 +1,27 @@ |
+// 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" |
+ |
+void RunWeb2SocketServer(const std::string& origin, int port) { |
+ for (int step = 0;; step += (step < 10)) { |
+ int p = fork(); |
+ if (p == 0) { |
+ if (Web2SocketServ::IgnoreSigPipe()) { |
+ Web2SocketServ ws(origin, port); |
+ ws.Run(); |
+ } |
+ exit(1); |
+ } |
+ if (p > 0) { |
+ waitpid(p, NULL, 0); |
+ } |
+ sleep(1 << step); |
+ } |
+} |
+ |