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.36 by pippijn, Sat Jan 20 13:47:17 2007 UTC vs.
Revision 1.41 by root, Wed Mar 14 15:44:47 2007 UTC

129 mapmode = Map0Cmd; 129 mapmode = Map0Cmd;
130 darkness = 1; 130 darkness = 1;
131 mapx = 11; 131 mapx = 11;
132 mapy = 11; 132 mapy = 11;
133 itemcmd = 1; /* Default is version item1 command */ 133 itemcmd = 1; /* Default is version item1 command */
134 134 max_rate = 100000 / (1000000 / MAX_TIME); // ~1mbit is assumed per default
135 faces_sent = salloc0<uint8> (nrofpixmaps);
136 135
137 /* Do this so we don't send a face command for the client for 136 /* Do this so we don't send a face command for the client for
138 * this face. Face 0 is sent to the client to say clear 137 * this face. Face 0 is sent to the client to say clear
139 * face information. 138 * face information.
140 */ 139 */
141 faces_sent[0] = NS_FACESENT_FACE; 140 faces_sent[0] = true;
142 141
143 // socket I/O is low priority
144 // we prefer to have the server run instead of handling client requests
145 socket_ev.prio (PE_PRIO_NORMAL + 1); 142 socket_ev.prio (PE_PRIO_NORMAL);
146 socket_ev.fd (fd); 143 socket_ev.fd (fd);
147 socket_ev.poll (PE_R); 144 socket_ev.poll (PE_R);
148 145
149 // command handling is even lower priority
150 // that way no client can monopolise the server
151 cmd_ev.prio (PE_PRIO_NORMAL + 2); 146 cmd_ev.prio (PE_PRIO_NORMAL);
152 147
153 // initialisation done, kick it! 148 // initialisation done, kick it!
154 send_packet_printf ("version %d %d %s\n", VERSION_CS, VERSION_SC, VERSION_INFO); 149 send_packet_printf ("version %d %d %s\n", VERSION_CS, VERSION_SC, VERSION_INFO);
155 flush (); 150 flush ();
156 151
161 156
162client::~client () 157client::~client ()
163{ 158{
164 clients.erase (this); 159 clients.erase (this);
165 160
166 sfree<uint8> (faces_sent, nrofpixmaps);
167 free (stats.range); 161 free (stats.range);
168 free (stats.title); 162 free (stats.title);
169 free (host); 163 free (host);
170} 164}
171 165
230{ 224{
231 cst_tot.time_start = time (NULL); 225 cst_tot.time_start = time (NULL);
232 cst_lst.time_start = time (NULL); 226 cst_lst.time_start = time (NULL);
233 227
234 LOG (llevDebug, "Initialize new client/server data\n"); 228 LOG (llevDebug, "Initialize new client/server data\n");
235
236 read_client_images ();
237} 229}
238 230
239 231
240/******************************************************************************* 232/*******************************************************************************
241 * 233 *
252} 244}
253 245
254client * 246client *
255client::create (int fd, const char *peername) 247client::create (int fd, const char *peername)
256{ 248{
257 if (checkbanned (NULL, peername))
258 {
259 LOG (llevInfo, "Banned host tried to connect: [%s]\n", peername);
260 return 0;
261 }
262 else
263 {
264 client *ns = new client (dup (fd), peername); 249 client *ns = new client (dup (fd), peername);
265
266 ns->instantiate (); // effectively a nop right now 250 ns->instantiate (); // effectively a nop right now
267
268 INVOKE_CLIENT (CONNECT, ns); 251 INVOKE_CLIENT (CONNECT, ns);
269
270 return ns; 252 return ns;
271 }
272} 253}
273 254

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines