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.50 by root, Sun Jun 3 17:05:36 2007 UTC vs.
Revision 1.51 by root, Sat Jun 9 22:54:04 2007 UTC

30 * 30 *
31 * loop.c mainly deals with initialization and higher level socket 31 * loop.c mainly deals with initialization and higher level socket
32 * maintanance (checking for lost connections and if data has arrived.) 32 * maintanance (checking for lost connections and if data has arrived.)
33 */ 33 */
34 34
35#define BG_SCRUB_RATE 4 // how often to send a face in the background
36
37#include <global.h> 35#include <global.h>
38#include <sproto.h> 36#include <sproto.h>
39#include <sockproto.h> 37#include <sockproto.h>
40 38
41#include <sys/types.h> 39#include <sys/types.h>
47#include <unistd.h> 45#include <unistd.h>
48#include <arpa/inet.h> 46#include <arpa/inet.h>
49 47
50#include <loader.h> 48#include <loader.h>
51 49
50#define BG_SCRUB_RATE 4 // how often to send a face in the background
51
52#define MAX_QUEUE_DEPTH 500 //TODO 52#define MAX_QUEUE_DEPTH 500
53#define MAX_QUEUE_BACKLOG 3. //TODO 53#define MAX_QUEUE_BACKLOG 3.
54 54
55void 55void
56client::reset_state () 56client::reset_state ()
57{ 57{
58 if (!pl) 58 if (!pl)
63} 63}
64 64
65void 65void
66client::queue_command (packet_type *handler, char *data, int datalen) 66client::queue_command (packet_type *handler, char *data, int datalen)
67{ 67{
68 tstamp stamp = now (); 68 tstamp stamp = NOW;
69 69
70 if (cmd_queue.size () >= MAX_QUEUE_DEPTH) 70 if (cmd_queue.size () >= MAX_QUEUE_DEPTH)
71 { 71 {
72 //TODO: just disconnect here? 72 //TODO: just disconnect here?
73 reset_state (); 73 reset_state ();
91 && state == ST_PLAYING 91 && state == ST_PLAYING
92 && pl->ob->speed_left > 0.f) 92 && pl->ob->speed_left > 0.f)
93 { 93 {
94 command &cmd = cmd_queue.front (); 94 command &cmd = cmd_queue.front ();
95 95
96 if (cmd.stamp + MAX_QUEUE_BACKLOG < now ()) 96 if (cmd.stamp + MAX_QUEUE_BACKLOG < NOW)
97 { 97 {
98 reset_state (); 98 reset_state ();
99 send_packet_printf ("drawinfo %d ignoring delayed commands.", NDI_RED); 99 send_packet_printf ("drawinfo %d ignoring delayed commands.", NDI_RED);
100 } 100 }
101 else 101 else
123 * 123 *
124 */ 124 */
125void 125void
126doeric_server (void) 126doeric_server (void)
127{ 127{
128#ifdef CS_LOGSTATS
129 if ((time (NULL) - cst_lst.time_start) >= CS_LOGTIME)
130 write_cs_stats ();
131#endif
132
133 //TODO: should not be done here, either 128 //TODO: should not be done here, either
134 for (unsigned i = 0; i < clients.size (); ++i) 129 for (unsigned i = 0; i < clients.size (); ++i)
135 { 130 {
136 client *ns = clients [i]; 131 client *ns = clients [i];
137 132

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines