ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/socket/init.C
(Generate patch)

Comparing deliantra/server/socket/init.C (file contents):
Revision 1.12 by root, Thu Dec 14 00:01:35 2006 UTC vs.
Revision 1.13 by root, Thu Dec 14 01:12:35 2006 UTC

59 * client. 59 * client.
60 */ 60 */
61void 61void
62InitConnection (NewSocket *ns, const char *from_ip) 62InitConnection (NewSocket *ns, const char *from_ip)
63{ 63{
64 SockList sl;
65 char buf[256];
66 int bufsize = 65535; /*Supposed absolute upper limit */ 64 int bufsize = 65535; /*Supposed absolute upper limit */
67 int oldbufsize; 65 int oldbufsize;
68 int buflen = sizeof (int); 66 int buflen = sizeof (int);
69 67
70 if (fcntl (ns->fd, F_SETFL, O_NONBLOCK) == -1) 68 if (fcntl (ns->fd, F_SETFL, O_NONBLOCK) == -1)
139 ns->client[0] = 0; 137 ns->client[0] = 0;
140 ns->buggy_mapscroll = 0; 138 ns->buggy_mapscroll = 0;
141 139
142 ns->sent_scroll = 0; 140 ns->sent_scroll = 0;
143 ns->host = strdup_local (from_ip); 141 ns->host = strdup_local (from_ip);
142
143 {
144 SockList sl (MAXSOCKBUF);
145
144 sprintf ((char *) buf, "version %d %d %s\n", VERSION_CS, VERSION_SC, VERSION_INFO); 146 sl.printf ("version %d %d %s\n", VERSION_CS, VERSION_SC, VERSION_INFO);
145 sl.buf = (unsigned char *) buf;
146 sl.len = strlen ((char *) buf);
147 Send_With_Handling (ns, &sl); 147 Send_With_Handling (ns, &sl);
148 sl.free ();
149 }
150
148#ifdef CS_LOGSTATS 151#ifdef CS_LOGSTATS
149 if (socket_info.nconns > cst_tot.max_conn) 152 if (socket_info.nconns > cst_tot.max_conn)
150 cst_tot.max_conn = socket_info.nconns; 153 cst_tot.max_conn = socket_info.nconns;
151 if (socket_info.nconns > cst_lst.max_conn) 154 if (socket_info.nconns > cst_lst.max_conn)
152 cst_lst.max_conn = socket_info.nconns; 155 cst_lst.max_conn = socket_info.nconns;
268 271
269/** Sends the 'goodbye' command to the player, and closes connection. */ 272/** Sends the 'goodbye' command to the player, and closes connection. */
270void 273void
271final_free_player (player *pl) 274final_free_player (player *pl)
272{ 275{
273 cs_write_string (&pl->socket, "goodbye", 8); 276 pl->socket.send_packet ("goodbye");
274 free_newsocket (&pl->socket); 277 free_newsocket (&pl->socket);
275 free_player (pl); 278 free_player (pl);
276} 279}
280

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines