/[resiprocate]/main/reTurn/reTurnServer.cxx
ViewVC logotype

Diff of /main/reTurn/reTurnServer.cxx

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 7321 by sgodin, Sun Oct 14 18:18:46 2007 UTC revision 7322 by sgodin, Sun Oct 14 21:00:24 2007 UTC
# Line 29  Line 29 
29      return FALSE;      return FALSE;
30    }    }
31  }  }
32    #endif // defined(_WIN32)
33    
34    
35  class reTurnConfig  class reTurnConfig
36  {  {
# Line 71  Line 73 
73      a2p1UdpServer.setAlternateUdpServers(&a2p2UdpServer, &a1p1UdpServer, &a1p2UdpServer);      a2p1UdpServer.setAlternateUdpServers(&a2p2UdpServer, &a1p1UdpServer, &a1p2UdpServer);
74      a2p2UdpServer.setAlternateUdpServers(&a2p1UdpServer, &a1p2UdpServer, &a1p1UdpServer);      a2p2UdpServer.setAlternateUdpServers(&a2p1UdpServer, &a1p2UdpServer, &a1p1UdpServer);
75    
76    #ifdef _WIN32
77      // Set console control handler to allow server to be stopped.      // Set console control handler to allow server to be stopped.
78      console_ctrl_function = boost::bind(&asio::io_service::stop, &ioService);      console_ctrl_function = boost::bind(&asio::io_service::stop, &ioService);
79      SetConsoleCtrlHandler(console_ctrl_handler, TRUE);      SetConsoleCtrlHandler(console_ctrl_handler, TRUE);
80    #else
81        // Block all signals for background thread.
82        sigset_t new_mask;
83        sigfillset(&new_mask);
84        sigset_t old_mask;
85        pthread_sigmask(SIG_BLOCK, &new_mask, &old_mask);
86    #endif
87    
88      // Run the ioService until stopped.      // Run the ioService until stopped.
89      // Create a pool of threads to run all of the io_services.      // Create a pool of threads to run all of the io_services.
# Line 85  Line 95 
95         threads.push_back(thread);         threads.push_back(thread);
96      }      }
97    
98    #ifndef _WIN32
99        // Restore previous signals.
100        pthread_sigmask(SIG_SETMASK, &old_mask, 0);
101    
102        // Wait for signal indicating time to shut down.
103        sigset_t wait_mask;
104        sigemptyset(&wait_mask);
105        sigaddset(&wait_mask, SIGINT);
106        sigaddset(&wait_mask, SIGQUIT);
107        sigaddset(&wait_mask, SIGTERM);
108        pthread_sigmask(SIG_BLOCK, &wait_mask, 0);
109        int sig = 0;
110        sigwait(&wait_mask, &sig);
111    #endif
112    
113      // Wait for all threads in the pool to exit.      // Wait for all threads in the pool to exit.
114      for (std::size_t i = 0; i < threads.size(); ++i)      for (std::size_t i = 0; i < threads.size(); ++i)
115      {      {
# Line 99  Line 124 
124    return 0;    return 0;
125  }  }
126    
 #endif // defined(_WIN32)  
   
127    
128  /* ====================================================================  /* ====================================================================
129    

Legend:
Removed from v.7321  
changed lines
  Added in v.7322

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27