~ubuntu-branches/ubuntu/jaunty/asio/jaunty

« back to all changes in this revision

Viewing changes to src/examples/http/server/connection_manager.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Simon Richter
  • Date: 2007-09-07 11:10:41 UTC
  • Revision ID: james.westby@ubuntu.com-20070907111041-f0uwhs0llvzj9ah5
Tags: upstream-0.3.8~rc3
ImportĀ upstreamĀ versionĀ 0.3.8~rc3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//
 
2
// connection_manager.hpp
 
3
// ~~~~~~~~~~~~~~~~~~~~~~
 
4
//
 
5
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
 
6
//
 
7
// Distributed under the Boost Software License, Version 1.0. (See accompanying
 
8
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
9
//
 
10
 
 
11
#ifndef HTTP_CONNECTION_MANAGER_HPP
 
12
#define HTTP_CONNECTION_MANAGER_HPP
 
13
 
 
14
#include <set>
 
15
#include <boost/noncopyable.hpp>
 
16
#include "connection.hpp"
 
17
 
 
18
namespace http {
 
19
namespace server {
 
20
 
 
21
/// Manages open connections so that they may be cleanly stopped when the server
 
22
/// needs to shut down.
 
23
class connection_manager
 
24
  : private boost::noncopyable
 
25
{
 
26
public:
 
27
  /// Add the specified connection to the manager and start it.
 
28
  void start(connection_ptr c);
 
29
 
 
30
  /// Stop the specified connection.
 
31
  void stop(connection_ptr c);
 
32
 
 
33
  /// Stop all connections.
 
34
  void stop_all();
 
35
 
 
36
private:
 
37
  /// The managed connections.
 
38
  std::set<connection_ptr> connections_;
 
39
};
 
40
 
 
41
} // namespace server
 
42
} // namespace http
 
43
 
 
44
#endif // HTTP_CONNECTION_MANAGER_HPP