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.26 by root, Wed Dec 20 09:14:22 2006 UTC vs.
Revision 1.27 by root, Thu Dec 21 06:12:37 2006 UTC

29 * 29 *
30 * Mainly deals with initialization and higher level socket 30 * Mainly deals with initialization and higher level socket
31 * maintenance (checking for lost connections and if data has arrived.) 31 * maintenance (checking for lost connections and if data has arrived.)
32 * The reading of data is handled in ericserver.c 32 * The reading of data is handled in ericserver.c
33 */ 33 */
34
35 34
36#include <global.h> 35#include <global.h>
37#include <sproto.h> 36#include <sproto.h>
38#include <sys/types.h> 37#include <sys/types.h>
39#include <sys/time.h> 38#include <sys/time.h>
121 getsockopt (fd, SOL_SOCKET, SO_SNDBUF, (char *) &oldbufsize, (socklen_t *) & buflen); 120 getsockopt (fd, SOL_SOCKET, SO_SNDBUF, (char *) &oldbufsize, (socklen_t *) & buflen);
122 } 121 }
123 122
124 mapmode = Map0Cmd; 123 mapmode = Map0Cmd;
125 darkness = 1; 124 darkness = 1;
126 status = Ns_Add;
127 mapx = 11; 125 mapx = 11;
128 mapy = 11; 126 mapy = 11;
129 itemcmd = 1; /* Default is version item1 command */ 127 itemcmd = 1; /* Default is version item1 command */
130 128
131 faces_sent = salloc<uint8> (nrofpixmaps, 0); 129 faces_sent = salloc0<uint8> (nrofpixmaps);
132 130
133 /* Do this so we don't send a face command for the client for 131 /* Do this so we don't send a face command for the client for
134 * this face. Face 0 is sent to the client to say clear 132 * this face. Face 0 is sent to the client to say clear
135 * face information. 133 * face information.
136 */ 134 */
172} 170}
173 171
174void 172void
175client::destroy () 173client::destroy ()
176{ 174{
177 status = Ns_Dead; 175 destroyed = true;
176
178 socket_ev.suspend (); 177 socket_ev.suspend ();
179 cmd_ev.suspend (); 178 cmd_ev.suspend ();
180} 179}
181 180
182/** This sets up the socket and reads all the image information into memory. */ 181/** This sets up the socket and reads all the image information into memory. */
211final_free_player (player *pl) 210final_free_player (player *pl)
212{ 211{
213 free_player (pl); 212 free_player (pl);
214} 213}
215 214
216bool 215client *
217add_client (int fd, const char *peername) 216client::create (int fd, const char *peername)
218{ 217{
219 if (checkbanned (NULL, peername)) 218 if (checkbanned (NULL, peername))
220 { 219 {
221 LOG (llevInfo, "Banned host tried to connect: [%s]\n", peername); 220 LOG (llevInfo, "Banned host tried to connect: [%s]\n", peername);
222 return false; 221 return 0;
223 } 222 }
224 else 223 else
225 { 224 {
226 client *ns = new client (dup (fd), peername); 225 client *ns = new client (dup (fd), peername);
227 clients.push_back (ns); 226 clients.push_back (ns);
227
228 ns->instantiate (); // effectively a nop right now
229
230 INVOKE_CLIENT (CONNECT, ns);
231
228 return true; 232 return ns;
229 } 233 }
230} 234}
231 235

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines