--- deliantra/server/socket/loop.C 2006/12/22 16:34:00 1.32 +++ deliantra/server/socket/loop.C 2007/01/06 14:42:31 1.36 @@ -1,6 +1,7 @@ /* CrossFire, A Multiplayer game for X-windows + Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team Copyright (C) 2002-2003 Mark Wedel & The Crossfire Development Team Copyright (C) 1992 Frank Tore Johansen @@ -48,7 +49,7 @@ #include #define MAX_QUEUE_DEPTH 500 //TODO -#define MAX_QUEUE_BACKLOG 5. //TODO +#define MAX_QUEUE_BACKLOG 3. //TODO void client::reset_state () @@ -136,29 +137,13 @@ write_cs_stats (); #endif - for (sockvec::iterator i = clients.begin (); i != clients.end (); ) + //TODO: should not be done here, either + for (int i = 0; i < clients.size (); ++i) { - client *s = *i; - - if (s->destroyed ()) - { - clients.erase (i); - delete s; - } - else - ++i; - } - - /* We need to do some of the processing below regardless */ - - /* Check for any input on the sockets */ - for (sockvec::iterator i = clients.begin (); i != clients.end (); ++i) - { - client *s = *i; + client *s = clients [i]; player *pl = s->pl; - //TODO: should not be done here, either - if (!s->destroyed () && pl) + if (pl && pl->ns && !pl->ns->destroyed ()) { /* Update the players stats once per tick. More efficient than * sending them whenever they change, and probably just as useful @@ -178,6 +163,8 @@ if (s->update_look) esrv_draw_look (pl->ob); } + + s->refcnt_chk (); } }