Debian Codegraph @

src/d2cs/serverqueue.cpp

raw symbols SCIP
1 /*
2 * Copyright (C) 2000,2001 Onlyer ([email protected])
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18 #include "common/setup_before.h"cxx . . $ `<file>/src/common/setup_before.h`/
19 #include "setup.h"cxx . . $ `<file>/src/d2cs/setup.h`/
20 #include "serverqueue.h"cxx . . $ `<file>/src/d2cs/serverqueue.h`/
21
22 #include <ctime>
23
24 #include "common/eventlog.h"cxx . . $ `<file>/src/common/eventlog.h`/
25 #include "common/xalloc.h"cxx . . $ `<file>/src/common/xalloc.h`/
26 /*
27 #include "common/packet.h"
28 #include "common/list.h"
29 */
30 #include "prefs.h"cxx . . $ `<file>/src/d2cs/prefs.h`/
31 #include "common/setup_after.h"cxx . . $ `<file>/src/common/setup_after.h`/
32
33 namespace pvpgncxx . . $ pvpgn/
34 {
35
36 namespace d2cscxx . . $ pvpgn/d2cs/
37 {
38
39 static t_listcxx . . $ pvpgn/t_list# * sqlist_headcxx . . $ pvpgn/d2cs/sqlist_head.=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
40 static unsigned int sqlist_seqnocxx . . $ pvpgn/d2cs/sqlist_seqno.=0;
41
42 extern t_listcxx . . $ pvpgn/t_list# * sqlistcxx . . $ pvpgn/d2cs/sqlist(7a6cb11de248e2c9).(void)
43 {
44 return sqlist_headcxx . . $ pvpgn/d2cs/sqlist_head.;
45 }
46
47 extern int sqlist_createcxx . . $ pvpgn/d2cs/sqlist_create(b126dc7c1de90089).(void)
48 {
49 sqlist_headcxx . . $ pvpgn/d2cs/sqlist_head.=list_createcxx . . $ pvpgn/list_create(7a6cb11de248e2c9).();
50 return 0;
51 }
52
53 extern int sqlist_destroycxx . . $ pvpgn/d2cs/sqlist_destroy(b126dc7c1de90089).(void)
54 {
55 t_sqcxx . . $ pvpgn/d2cs/t_sq# * sq;
56
57 BEGIN_LIST_TRAVERSE_DATA_CONSTcxx . . $ `src/d2cs/setup.h:35:9`!(sqlist_head,sq,t_sq)
58 {
59 sq_destroycxx . . $ pvpgn/d2cs/sq_destroy(211ea308ebfa0f0e).(sq,(t_elemcxx . . $ pvpgn/t_elem# **)curr_elem_);
60 }
61 END_LIST_TRAVERSE_DATA_CONSTcxx . . $ `src/d2cs/setup.h:41:9`!()
62
63 if (list_destroycxx . . $ pvpgn/list_destroy(20db0232078327de).(sqlist_headcxx . . $ pvpgn/d2cs/sqlist_head.)<0) {
64 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error.,__FUNCTION__,"error destroy server queue list");
65 return -1;
66 }
67 sqlist_headcxx . . $ pvpgn/d2cs/sqlist_head.=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
68 return 0;
69 }
70
71 extern int sqlist_check_timeoutcxx . . $ pvpgn/d2cs/sqlist_check_timeout(b126dc7c1de90089).(void)
72 {
73 t_sqcxx . . $ pvpgn/d2cs/t_sq# * sq;
74 stdcxx . . $ std/::time_tcxx . . $ std/time_t# now;
75
76 now=stdcxx . . $ std/::timecxx . . $ std/time(a7cd306b2d326b09).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
77 BEGIN_LIST_TRAVERSE_DATAcxx . . $ `src/d2cs/setup.h:26:9`!(sqlist_head, sq, t_sq)
78 {
79 if (now - sq->ctimecxx . . $ pvpgn/d2cs/serverqueue#ctime. > prefs_get_sq_timeoutcxx . . $ pvpgn/d2cs/prefs_get_sq_timeout(db52760e79bf9054).()) {
80 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info.,__FUNCTION__,"destroying expired server queue {}",sq->seqnocxx . . $ pvpgn/d2cs/serverqueue#seqno.);
81 sq_destroycxx . . $ pvpgn/d2cs/sq_destroy(211ea308ebfa0f0e).(sq,&curr_elem_);
82 }
83 }
84 END_LIST_TRAVERSE_DATAcxx . . $ `src/d2cs/setup.h:32:9`!()
85 return 0;
86 }
87
88 extern t_sqcxx . . $ pvpgn/d2cs/t_sq# * sqlist_find_sqcxx . . $ pvpgn/d2cs/sqlist_find_sq(e493466095b7404b).(unsigned int seqno)
89 {
90 t_sqcxx . . $ pvpgn/d2cs/t_sq# * sq;
91
92 BEGIN_LIST_TRAVERSE_DATA_CONSTcxx . . $ `src/d2cs/setup.h:35:9`!(sqlist_head,sq,t_sq)
93 {
94 if (sq->seqnocxx . . $ pvpgn/d2cs/serverqueue#seqno.==seqno) return sq;
95 }
96 END_LIST_TRAVERSE_DATA_CONSTcxx . . $ `src/d2cs/setup.h:41:9`!()
97 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
98 }
99
100 extern t_sqcxx . . $ pvpgn/d2cs/t_sq# * sq_createcxx . . $ pvpgn/d2cs/sq_create(5729c0f3ffc7f2dd).(unsigned int clientid, t_packetcxx . . $ pvpgn/t_packet# * packet,unsigned int gameid )
101 {
102 t_sqcxx . . $ pvpgn/d2cs/t_sq# * sq;
103
104 sq=(t_sqcxx . . $ pvpgn/d2cs/t_sq#*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(sizeof(t_sq));
105 sq->seqnocxx . . $ pvpgn/d2cs/serverqueue#seqno.=++sqlist_seqnocxx . . $ pvpgn/d2cs/sqlist_seqno.;
106 sq->ctimecxx . . $ pvpgn/d2cs/serverqueue#ctime.=stdcxx . . $ std/::timecxx . . $ std/time(a7cd306b2d326b09).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
107 sq->clientidcxx . . $ pvpgn/d2cs/serverqueue#clientid.=clientid;
108 sq->gameidcxx . . $ pvpgn/d2cs/serverqueue#gameid.=gameid;
109 sq->packetcxx . . $ pvpgn/d2cs/serverqueue#packet.=packet;
110 sq->gametokencxx . . $ pvpgn/d2cs/serverqueue#gametoken.=0;
111 if (packet) packet_add_refcxx . . $ pvpgn/packet_add_ref(671b48e8886379c2).(packet);
112 list_append_datacxx . . $ pvpgn/list_append_data(4e1348bd294d996f).(sqlist_headcxx . . $ pvpgn/d2cs/sqlist_head.,sq);
113 return sq;
114 }
115
116 extern int sq_destroycxx . . $ pvpgn/d2cs/sq_destroy(211ea308ebfa0f0e).(t_sqcxx . . $ pvpgn/d2cs/t_sq# * sq,t_elemcxx . . $ pvpgn/t_elem# ** curr)
117 {
118 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(sq,-1);
119 if (list_remove_datacxx . . $ pvpgn/list_remove_data(9d29d8ce7cabbadf).(sqlist_headcxx . . $ pvpgn/d2cs/sqlist_head.,sq,curr)<0) {
120 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error.,__FUNCTION__,"error remove server queue from list");
121 return -1;
122 }
123 if (sq->packetcxx . . $ pvpgn/d2cs/serverqueue#packet.) packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(sq->packetcxx . . $ pvpgn/d2cs/serverqueue#packet.);
124 xfreecxx . . $ `src/common/xalloc.h:51:9`!(sq);
125 return 0;
126 }
127
128 extern unsigned int sq_get_clientidcxx . . $ pvpgn/d2cs/sq_get_clientid(b4250823e36b6ab).(t_sqcxx . . $ pvpgn/d2cs/t_sq# const * sq)
129 {
130 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(sq,0);
131 return sq->clientidcxx . . $ pvpgn/d2cs/serverqueue#clientid.;
132 }
133
134 extern t_packetcxx . . $ pvpgn/t_packet# * sq_get_packetcxx . . $ pvpgn/d2cs/sq_get_packet(cc7363a0c7bb9fd0).(t_sqcxx . . $ pvpgn/d2cs/t_sq# const * sq)
135 {
136 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(sq,NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
137 return sq->packetcxx . . $ pvpgn/d2cs/serverqueue#packet.;
138 }
139
140 extern unsigned int sq_get_gameidcxx . . $ pvpgn/d2cs/sq_get_gameid(b4250823e36b6ab).(t_sqcxx . . $ pvpgn/d2cs/t_sq# const * sq)
141 {
142 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(sq,0);
143 return sq->gameidcxx . . $ pvpgn/d2cs/serverqueue#gameid.;
144 }
145
146 extern unsigned int sq_get_seqnocxx . . $ pvpgn/d2cs/sq_get_seqno(b4250823e36b6ab).(t_sqcxx . . $ pvpgn/d2cs/t_sq# const * sq)
147 {
148 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(sq,0);
149 return sq->seqnocxx . . $ pvpgn/d2cs/serverqueue#seqno.;
150 }
151
152 extern int sq_set_gametokencxx . . $ pvpgn/d2cs/sq_set_gametoken(7475dc365c93b47d).(t_sqcxx . . $ pvpgn/d2cs/t_sq# * sq, unsigned int gametoken)
153 {
154 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(sq,-1);
155 sq->gametokencxx . . $ pvpgn/d2cs/serverqueue#gametoken.=gametoken;
156 return 0;
157 }
158
159 extern unsigned int sq_get_gametokencxx . . $ pvpgn/d2cs/sq_get_gametoken(b4250823e36b6ab).(t_sqcxx . . $ pvpgn/d2cs/t_sq# const * sq)
160 {
161 ASSERTcxx . . $ `src/d2cs/setup.h:67:9`!(sq,0);
162 return sq->gametokencxx . . $ pvpgn/d2cs/serverqueue#gametoken.;
163 }
164
165 }
166
167 }