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

Comparing deliantra/server/socket/loop.C (file contents):
Revision 1.32 by root, Fri Dec 22 16:34:00 2006 UTC vs.
Revision 1.35 by root, Tue Jan 2 11:08:36 2007 UTC

46#include <arpa/inet.h> 46#include <arpa/inet.h>
47 47
48#include <loader.h> 48#include <loader.h>
49 49
50#define MAX_QUEUE_DEPTH 500 //TODO 50#define MAX_QUEUE_DEPTH 500 //TODO
51#define MAX_QUEUE_BACKLOG 5. //TODO 51#define MAX_QUEUE_BACKLOG 3. //TODO
52 52
53void 53void
54client::reset_state () 54client::reset_state ()
55{ 55{
56 if (!pl) 56 if (!pl)
134#ifdef CS_LOGSTATS 134#ifdef CS_LOGSTATS
135 if ((time (NULL) - cst_lst.time_start) >= CS_LOGTIME) 135 if ((time (NULL) - cst_lst.time_start) >= CS_LOGTIME)
136 write_cs_stats (); 136 write_cs_stats ();
137#endif 137#endif
138 138
139 for (sockvec::iterator i = clients.begin (); i != clients.end (); ) 139 //TODO: should not be done here, either
140 for (int i = 0; i < clients.size (); ++i)
140 { 141 {
141 client *s = *i; 142 client *s = clients [i];
142
143 if (s->destroyed ())
144 {
145 clients.erase (i);
146 delete s;
147 }
148 else
149 ++i;
150 }
151
152 /* We need to do some of the processing below regardless */
153
154 /* Check for any input on the sockets */
155 for (sockvec::iterator i = clients.begin (); i != clients.end (); ++i)
156 {
157 client *s = *i;
158 player *pl = s->pl; 143 player *pl = s->pl;
159 144
160 //TODO: should not be done here, either 145 if (pl && pl->ns && !pl->ns->destroyed ())
161 if (!s->destroyed () && pl)
162 { 146 {
163 /* Update the players stats once per tick. More efficient than 147 /* Update the players stats once per tick. More efficient than
164 * sending them whenever they change, and probably just as useful 148 * sending them whenever they change, and probably just as useful
165 */ 149 */
166 esrv_update_stats (pl); 150 esrv_update_stats (pl);
176 draw_client_map (pl->ob); 160 draw_client_map (pl->ob);
177 161
178 if (s->update_look) 162 if (s->update_look)
179 esrv_draw_look (pl->ob); 163 esrv_draw_look (pl->ob);
180 } 164 }
165
166 s->refcnt_chk ();
181 } 167 }
182} 168}
183 169

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines