… | |
… | |
56 | * Initializes a connection. Really, it just sets up the data structure, |
56 | * Initializes a connection. Really, it just sets up the data structure, |
57 | * socket setup is handled elsewhere. We do send a version to the |
57 | * socket setup is handled elsewhere. We do send a version to the |
58 | * client. |
58 | * client. |
59 | */ |
59 | */ |
60 | client_socket::client_socket (int fd, const char *peername) |
60 | client_socket::client_socket (int fd, const char *peername) |
61 | : fd (fd), host (strdup (peername)) |
61 | : fd (fd), host (strdup (peername)), |
|
|
62 | socket_ev (this, &client_socket::socket_cb) |
62 | { |
63 | { |
63 | { |
64 | { |
64 | struct linger linger_opt; |
65 | struct linger linger_opt; |
65 | |
66 | |
66 | linger_opt.l_onoff = 0; |
67 | linger_opt.l_onoff = 0; |
… | |
… | |
105 | * this face. Face 0 is sent to the client to say clear |
106 | * this face. Face 0 is sent to the client to say clear |
106 | * face information. |
107 | * face information. |
107 | */ |
108 | */ |
108 | faces_sent[0] = NS_FACESENT_FACE; |
109 | faces_sent[0] = NS_FACESENT_FACE; |
109 | |
110 | |
110 | can_write = 1; |
111 | socket_ev.fd (fd); |
111 | |
112 | |
112 | // initialisation done, kick it! |
113 | // initialisation done, kick it! |
113 | |
114 | |
114 | { |
115 | { |
115 | packet sl; |
116 | packet sl; |
116 | sl.printf ("version %d %d %s\n", VERSION_CS, VERSION_SC, VERSION_INFO); |
117 | sl.printf ("version %d %d %s\n", VERSION_CS, VERSION_SC, VERSION_INFO); |
117 | send_packet (sl); |
118 | send_packet (sl); |
|
|
119 | flush (); |
118 | } |
120 | } |
119 | |
121 | |
120 | #if 0//TODO |
122 | #if 0//TODO |
121 | socket_info.nconns++; |
123 | socket_info.nconns++; |
122 | if (socket_info.nconns > cst_tot.max_conn) cst_tot.max_conn = socket_info.nconns; |
124 | if (socket_info.nconns > cst_tot.max_conn) cst_tot.max_conn = socket_info.nconns; |