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.79 by root, Wed Mar 18 11:09:14 2009 UTC vs.
Revision 1.83 by root, Tue Nov 3 23:44:21 2009 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002-2003,2007 Mark Wedel & The Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 * 5 *
8 * Deliantra is free software: you can redistribute it and/or modify 6 * Deliantra is free software: you can redistribute it and/or modify it under
9 * it under the terms of the GNU General Public License as published by 7 * the terms of the Affero GNU General Public License as published by the
10 * the Free Software Foundation, either version 3 of the License, or 8 * Free Software Foundation, either version 3 of the License, or (at your
11 * (at your option) any later version. 9 * option) any later version.
12 * 10 *
13 * This program is distributed in the hope that it will be useful, 11 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 14 * GNU General Public License for more details.
17 * 15 *
18 * You should have received a copy of the GNU General Public License 16 * You should have received a copy of the Affero GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * and the GNU General Public License along with this program. If not, see
18 * <http://www.gnu.org/licenses/>.
20 * 19 *
21 * The authors can be reached via e-mail to <support@deliantra.net> 20 * The authors can be reached via e-mail to <support@deliantra.net>
22 */ 21 */
23 22
24/** 23/**
48 47
49#define BG_SCRUB_RATE 4 // how often to send a face in the background 48#define BG_SCRUB_RATE 4 // how often to send a face in the background
50 49
51#define MAX_QUEUE_DEPTH 50 50#define MAX_QUEUE_DEPTH 50
52#define MAX_QUEUE_BACKLOG 3. 51#define MAX_QUEUE_BACKLOG 3.
53
54// disconnect a socket after this many seconds without an ack
55#define SOCKET_TIMEOUT 16.
56 52
57void 53void
58client::reset_state () 54client::reset_state ()
59{ 55{
60 if (!pl) 56 if (!pl)
166 tcpi.tcpi_snd_ssthresh, tcpi.tcpi_snd_cwnd, tcpi.tcpi_advmss, tcpi.tcpi_pmtu, tcpi.tcpi_advmss, 162 tcpi.tcpi_snd_ssthresh, tcpi.tcpi_snd_cwnd, tcpi.tcpi_advmss, tcpi.tcpi_pmtu, tcpi.tcpi_advmss,
167 163
168 tcpi.tcpi_snd_cwnd - (tcpi.tcpi_unacked - tcpi.tcpi_sacked)); 164 tcpi.tcpi_snd_cwnd - (tcpi.tcpi_unacked - tcpi.tcpi_sacked));
169#endif 165#endif
170 166
171 // fast-time-out a player by checking for missign acks 167 // fast-time-out a player by checking for missing acks
172 // do this only when player is active 168 // do this only when player is active
173 if (pl && pl->active 169 if (pl && pl->active
174 && tcpi.tcpi_last_ack_recv > int (SOCKET_TIMEOUT * 1000)) 170 && tcpi.tcpi_last_ack_recv > int (socket_timeout * 1000))
175 { 171 {
176 send_msg (NDI_RED | NDI_REPLY, "connection-timeout", "safety disconnect due to tcp/ip timeout (no packets received)"); 172 send_msg (NDI_RED | NDI_REPLY, "connection-timeout", "safety disconnect due to tcp/ip timeout (no packets received)");
177 write_outputbuffer (); 173 write_outputbuffer ();
178 174
179 LOG (llevDebug, "connection on fd %d closed due to ack timeout (%u/%u/%u)\n", fd, 175 LOG (llevDebug, "connection on fd %d closed due to ack timeout (%u/%u/%u)\n", fd,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines