X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=acceptor.h;fp=acceptor.h;h=199aea321284098fed2b97cd404b69ef3b506605;hp=e0a1bd54811df6e4be0a28de9f5e415d48cc53b5;hb=f2530dbb8415f9e7cc0f2d4b45741120c95e8a05;hpb=40eab3b7a07862a5547fc178e1edec22522ed7dc diff --git a/acceptor.h b/acceptor.h index e0a1bd5..199aea3 100644 --- a/acceptor.h +++ b/acceptor.h @@ -1,21 +1,26 @@ #ifndef _ACCEPTOR_H #define _ACCEPTOR_H +#include + #include "thread.h" enum SocketType { TCP_SOCKET, UDP_SOCKET, }; -int create_server_socket(int port, SocketType socket_type); +int create_server_socket(const sockaddr_in6 &addr, SocketType socket_type); class AcceptorProto; +sockaddr_in6 CreateAnyAddress(int port); +sockaddr_in6 ExtractAddressFromAcceptorProto(const AcceptorProto &proto); + // A thread that accepts new connections on a given socket, // and hands them off to the server pool. class Acceptor : public Thread { public: - Acceptor(int server_sock, int port); + Acceptor(int server_sock, const sockaddr_in6 &addr); // Serialization/deserialization. Acceptor(const AcceptorProto &serialized); @@ -26,7 +31,8 @@ public: private: virtual void do_work(); - int server_sock, port; + int server_sock; + sockaddr_in6 addr; }; #endif // !defined(_ACCEPTOR_H)