--- deliantra/server/socket/init.C 2006/12/14 20:39:54 1.17 +++ deliantra/server/socket/init.C 2006/12/15 19:59:20 1.20 @@ -41,25 +41,19 @@ #include #include -#ifdef HAVE_UNISTD_H -# include -#endif - -#ifdef HAVE_ARPA_INET_H -# include -#endif -#include +#include +#include -sockvec client_sockets; +sockvec clients; /** * Initializes a connection. Really, it just sets up the data structure, * socket setup is handled elsewhere. We do send a version to the * client. */ -client_socket::client_socket (int fd, const char *peername) +client::client (int fd, const char *peername) : fd (fd), host (strdup (peername)), - socket_ev (this, &client_socket::socket_cb) + socket_ev (this, &client::socket_cb) { { struct linger linger_opt; @@ -108,7 +102,7 @@ */ faces_sent[0] = NS_FACESENT_FACE; - socket_ev.fd (fd).poll (PE_W).start (); + socket_ev.fd (fd); // initialisation done, kick it! @@ -116,6 +110,7 @@ packet sl; sl.printf ("version %d %d %s\n", VERSION_CS, VERSION_SC, VERSION_INFO); send_packet (sl); + flush (); } #if 0//TODO @@ -125,7 +120,7 @@ #endif } -client_socket::~client_socket () +client::~client () { status = Ns_Dead; } @@ -170,7 +165,7 @@ */ void -free_newsocket (client_socket *ns) +free_newsocket (client *ns) { if (ns->fd >= 0) close (ns->fd); @@ -199,7 +194,7 @@ } bool -add_client_socket (int fd, const char *peername) +add_client (int fd, const char *peername) { if (checkbanned (NULL, peername)) { @@ -208,8 +203,8 @@ } else { - client_socket *ns = new client_socket (dup (fd), peername); - client_sockets.push_back (ns); + client *ns = new client (dup (fd), peername); + clients.push_back (ns); return true; } }