… | |
… | |
18 | * and the GNU General Public License along with this program. If not, see |
18 | * and the GNU General Public License along with this program. If not, see |
19 | * <http://www.gnu.org/licenses/>. |
19 | * <http://www.gnu.org/licenses/>. |
20 | * |
20 | * |
21 | * The authors can be reached via e-mail to <support@deliantra.net> |
21 | * The authors can be reached via e-mail to <support@deliantra.net> |
22 | */ |
22 | */ |
23 | |
|
|
24 | using namespace std; |
|
|
25 | |
23 | |
26 | #include <global.h> |
24 | #include <global.h> |
27 | #include <sproto.h> |
25 | #include <sproto.h> |
28 | #include <cstdarg> |
26 | #include <cstdarg> |
29 | |
27 | |
… | |
… | |
31 | # include <sys/types.h> |
29 | # include <sys/types.h> |
32 | # include <sys/socket.h> |
30 | # include <sys/socket.h> |
33 | # include <netinet/in.h> |
31 | # include <netinet/in.h> |
34 | # include <netinet/tcp.h> |
32 | # include <netinet/tcp.h> |
35 | #endif |
33 | #endif |
|
|
34 | |
|
|
35 | using namespace std; |
36 | |
36 | |
37 | // force a packet when idle for more than this many seconds, |
37 | // force a packet when idle for more than this many seconds, |
38 | // forcing an ack regularly. |
38 | // forcing an ack regularly. |
39 | #define IDLE_PING 2. |
39 | #define IDLE_PING 2. |
40 | |
40 | |
… | |
… | |
280 | { |
280 | { |
281 | data = (char *)inbuf + 2; // better read garbage than segfault |
281 | data = (char *)inbuf + 2; // better read garbage than segfault |
282 | datalen = 0; |
282 | datalen = 0; |
283 | } |
283 | } |
284 | |
284 | |
285 | for (packet_type *pkt = packets; pkt < packets + array_length (packets); ++pkt) |
285 | for (packet_type *pkt = packets; pkt < packets + ecb_array_length (packets); ++pkt) |
286 | if (!strcmp ((char *)inbuf + 2, pkt->name)) |
286 | if (!strcmp ((char *)inbuf + 2, pkt->name)) |
287 | { |
287 | { |
288 | if (pkt->flags & PF_PLAYER && !always_immediate (this, pkt, data, datalen)) |
288 | if (pkt->flags & PF_PLAYER && !always_immediate (this, pkt, data, datalen)) |
289 | queue_command (pkt, data, datalen); |
289 | queue_command (pkt, data, datalen); |
290 | else |
290 | else |