OLD | NEW |
(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 #include <stdlib.h> |
| 6 |
| 7 #include <sys/wait.h> |
| 8 #include <unistd.h> |
| 9 |
| 10 #include "web2socket_serv.h" |
| 11 |
| 12 struct sockaddr; |
| 13 |
| 14 void RunWeb2SocketServer(const std::string& origin, |
| 15 struct sockaddr* addr, |
| 16 int addr_len) { |
| 17 for (int step = 0;; step += (step < 10)) { |
| 18 int p = fork(); |
| 19 if (p == 0) { |
| 20 if (Web2SocketServ::IgnoreSigPipe()) { |
| 21 Web2SocketServ ws(origin, addr, addr_len); |
| 22 ws.Run(); |
| 23 } |
| 24 exit(1); |
| 25 } |
| 26 if (p > 0) |
| 27 waitpid(p, NULL, 0); |
| 28 sleep(1 << step); |
| 29 } |
| 30 } |
| 31 |
OLD | NEW |