]> git.sesse.net Git - cubemap/blobdiff - acceptor.h
Support multiple listening sockets. Actually mostly because it makes the code somewha...
[cubemap] / acceptor.h
index f173e5b647e68d9c4d8cad2ac64e99b7c4523dd0..caa46474ce48d83185244cc2e977c155ce882e1b 100644 (file)
@@ -1,10 +1,28 @@
 #ifndef _ACCEPTOR_H
 #define _ACCEPTOR_H
 
+#include "thread.h"
+
 int create_server_socket(int port);
 
+class AcceptorProto;
+
 // A thread that accepts new connections on a given socket,
 // and hands them off to the server pool.
-void *acceptor_thread_run(void *arg);
+class Acceptor : public Thread {
+public:
+       Acceptor(int server_sock, int port);
+
+       // Serialization/deserialization.
+       Acceptor(const AcceptorProto &serialized);
+       AcceptorProto serialize() const;
+
+       void close_socket();
+
+private:
+       virtual void do_work();
+
+       int server_sock, port;
+};
 
 #endif  // !defined(_ACCEPTOR_H)