… | |
… | |
50 | |
50 | |
51 | #define MAX_QUEUE_DEPTH 50 |
51 | #define MAX_QUEUE_DEPTH 50 |
52 | #define MAX_QUEUE_BACKLOG 3. |
52 | #define MAX_QUEUE_BACKLOG 3. |
53 | |
53 | |
54 | // disconnect a socket after this many seconds without an ack |
54 | // disconnect a socket after this many seconds without an ack |
55 | #define SOCKET_TIMEOUT 8. |
55 | #define SOCKET_TIMEOUT 16. |
56 | |
56 | |
57 | void |
57 | void |
58 | client::reset_state () |
58 | client::reset_state () |
59 | { |
59 | { |
60 | if (!pl) |
60 | if (!pl) |
… | |
… | |
75 | reset_state (); |
75 | reset_state (); |
76 | send_packet_printf ("drawinfo %d command queue overflow, ignoring.", NDI_RED); |
76 | send_packet_printf ("drawinfo %d command queue overflow, ignoring.", NDI_RED); |
77 | } |
77 | } |
78 | else |
78 | else |
79 | { |
79 | { |
80 | cmd_queue.push_back (command ()); |
80 | cmd_queue.resize (cmd_queue.size () + 1); |
81 | command &cmd = cmd_queue.back (); |
81 | command &cmd = cmd_queue.back (); |
82 | cmd.stamp = stamp; |
82 | cmd.stamp = stamp; |
83 | cmd.handler = handler; |
83 | cmd.handler = handler; |
84 | cmd.data = salloc<char> (datalen + 1, data); |
84 | cmd.data = salloc<char> (datalen + 1, data); |
85 | cmd.datalen = datalen; |
85 | cmd.datalen = datalen; |
… | |
… | |
101 | send_packet_printf ("drawinfo %d ignoring delayed commands.", NDI_RED); |
101 | send_packet_printf ("drawinfo %d ignoring delayed commands.", NDI_RED); |
102 | } |
102 | } |
103 | else |
103 | else |
104 | execute (cmd.handler, cmd.data, cmd.datalen); |
104 | execute (cmd.handler, cmd.data, cmd.datalen); |
105 | |
105 | |
|
|
106 | sfree<char> (cmd.data, cmd.datalen + 1); |
106 | cmd_queue.pop_front (); |
107 | cmd_queue.pop_front (); |
107 | return true; |
108 | return true; |
108 | } |
109 | } |
109 | else |
110 | else |
110 | return false; |
111 | return false; |
… | |
… | |
119 | /* Update the players stats once per tick. More efficient than |
120 | /* Update the players stats once per tick. More efficient than |
120 | * sending them whenever they change, and probably just as useful |
121 | * sending them whenever they change, and probably just as useful |
121 | */ |
122 | */ |
122 | esrv_update_stats (pl); |
123 | esrv_update_stats (pl); |
123 | |
124 | |
|
|
125 | #if 0 |
124 | if (last_weight != -1 && last_weight != WEIGHT (pl->ob)) |
126 | if (last_weight != -1 && last_weight != pl->ob->client_weight ()) |
125 | { |
127 | { |
126 | esrv_update_item (UPD_WEIGHT, pl->ob, pl->ob); |
128 | esrv_update_item (UPD_WEIGHT, pl->ob, pl->ob); |
127 | if (last_weight != WEIGHT (pl->ob)) |
129 | if (last_weight != pl->ob->client_weight ()) |
128 | LOG (llevError, "esrv_update_item(UPD_WEIGHT) did not set player weight: is %lu, should be %lu\n", |
130 | LOG (llevError, "esrv_update_item(UPD_WEIGHT) did not set player weight: is %lu, should be %lu\n", |
129 | (unsigned long) last_weight, WEIGHT (pl->ob)); |
131 | (unsigned long) last_weight, pl->ob->client_weight ()); |
130 | } |
132 | } |
|
|
133 | #endif |
131 | |
134 | |
132 | draw_client_map (pl); |
135 | draw_client_map (pl); |
133 | |
136 | |
134 | if (update_look) |
137 | if (update_look) |
135 | esrv_draw_look (pl); |
138 | esrv_draw_look (pl); |