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

Unified Diff: net/web2socket_proxy/web2socket.cc

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 side-by-side diff with in-line comments
Download patch
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);
+ }
+}
+

Powered by Google App Engine
This is Rietveld 408576698