summaryrefslogtreecommitdiff
path: root/src/lib/server.h
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-06-20 00:53:40 +0100
committerCarl Hetherington <cth@carlh.net>2014-06-20 00:53:40 +0100
commit0da7c88a1afb221f97e2e96c159b1a984e4e2f71 (patch)
tree558590d5ad0a2ced262c2142915b738d898ddbf0 /src/lib/server.h
parent4a677ee9e750efc330c29df69f19dae27f09aa4d (diff)
parentda38ed791a5a46a97b26947409cf837b7939fd54 (diff)
Merge master; fix destruction of Server; some test cleanups.
Diffstat (limited to 'src/lib/server.h')
-rw-r--r--src/lib/server.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/server.h b/src/lib/server.h
index a9b4b1c1c..9f3e99f9c 100644
--- a/src/lib/server.h
+++ b/src/lib/server.h
@@ -90,6 +90,7 @@ class Server : public ExceptionStore, public boost::noncopyable
{
public:
Server (boost::shared_ptr<Log> log, bool verbose);
+ ~Server ();
void run (int num_threads);
@@ -98,14 +99,24 @@ private:
int process (boost::shared_ptr<Socket> socket, struct timeval &, struct timeval &);
void broadcast_thread ();
void broadcast_received ();
+ void start_accept ();
+ void handle_accept (boost::shared_ptr<Socket>, boost::system::error_code const &);
+
+ bool _terminate;
std::vector<boost::thread *> _worker_threads;
std::list<boost::shared_ptr<Socket> > _queue;
boost::mutex _worker_mutex;
boost::condition _worker_condition;
+
boost::shared_ptr<Log> _log;
bool _verbose;
+ boost::asio::io_service _io_service;
+ boost::asio::ip::tcp::acceptor _acceptor;
+
+ int _num_threads;
+
struct Broadcast {
Broadcast ()
@@ -117,6 +128,7 @@ private:
boost::asio::ip::udp::socket* socket;
char buffer[64];
boost::asio::ip::udp::endpoint send_endpoint;
+ boost::asio::io_service io_service;
} _broadcast;
};