7 #include <boost/thread.hpp> 
    8 #include <boost/bind.hpp> 
   20   AirInvServer::AirInvServer (
const std::string& address,
 
   21                               const std::string& port,
 
   22                               const stdair::AirlineCode_T& iAirlineCode,
 
   23                               std::size_t iThreadPoolSize)
 
   24     : _threadPoolSize (iThreadPoolSize), _acceptor (_ioService),
 
   25       _newConnection (new 
Connection (_ioService, _requestHandler)),
 
   26       _requestHandler (iAirlineCode) {
 
   30     boost::asio::ip::tcp::resolver resolver (_ioService);
 
   31     boost::asio::ip::tcp::resolver::query query (address, port);
 
   32     boost::asio::ip::tcp::endpoint endpoint = *resolver.resolve(query);
 
   34     _acceptor.open (endpoint.protocol());
 
   35     _acceptor.set_option (boost::asio::ip::tcp::acceptor::reuse_address(
true));
 
   36     _acceptor.bind (endpoint);
 
   39     assert (_newConnection != NULL);
 
   40     _acceptor.async_accept (_newConnection->socket(),
 
   41                             boost::bind (&AirInvServer::handleAccept, 
this,
 
   42                                          boost::asio::placeholders::error));
 
   54     for (std::size_t itThread = 0; itThread != _threadPoolSize; ++itThread) {
 
   55       ThreadShrPtr_T lThread (
new boost::thread (boost::bind (&boost::asio::io_service::run,
 
   57       lThreadList.push_back (lThread);
 
   61     for (std::size_t itThread = 0; itThread != lThreadList.size(); ++itThread) {
 
   62       boost::shared_ptr<boost::thread> lThread_ptr = lThreadList.at (itThread);
 
   63       assert (lThread_ptr != NULL);
 
   74   void AirInvServer::handleAccept (
const boost::system::error_code& iError) {
 
   78       assert (_newConnection != NULL);
 
   82       _newConnection->start();
 
   87       _newConnection.reset (
new Connection (_ioService, _requestHandler));
 
   89       _acceptor.async_accept (_newConnection->socket(),
 
   90                               boost::bind (&AirInvServer::handleAccept, 
this,
 
   91                                            boost::asio::placeholders::error));