📄 client_8h-source.html
字号:
00252 <span class="keywordtype">void</span> join_reader_thread(<span class="keywordtype">bool</span> invalidate_handle = <span class="keyword">false</span>);00253 00254 <span class="comment">//incoming server gamepacket: arg is unreliable data block of game packet. called </span>00255 <span class="comment">//from client reader thread.</span>00256 <span class="keywordtype">void</span> incoming_server_gamepacket(<a class="code" href="classbuffer__c.html">buffer_c</a> &udata, <span class="keywordtype">int</span> packet_id);00257 00258 <span class="comment">//incoming server leetpacket: arg is the full packet hopefully following the LEET protocol.</span>00259 <span class="keywordtype">void</span> incoming_server_leetpacket(<a class="code" href="classbuffer__c.html">buffer_c</a> &udata);00260 00261 <span class="comment">//start connect : called in the connect(true) call. returns false if there was a BAD internal</span>00262 <span class="comment">//error that prevented the connection code from running.</span>00263 <span class="keywordtype">bool</span> start_connect();00264 00265 <span class="comment">//stop connect : called to quit the reader thread and close the socket</span>00266 <span class="keywordtype">void</span> stop_connect();00267 00268 <span class="comment">//kill connection : shuts down a working connection</span>00269 <span class="keywordtype">void</span> kill_connection();00270 00271 <span class="comment">//disconnect. sends disconnection packets, etc. code_reason is an optional int</span>00272 <span class="comment">//that pops back up in the disconnected(...) game-client callbacks, unmodified</span>00273 <span class="keywordtype">void</span> disconnect(<span class="keywordtype">int</span> code_reason = 0);00274 00275 <span class="comment">//called when disconnection "happens" (done). closes station, joins reader thread, connect_state = 0...</span>00276 <span class="keywordtype">void</span> disconnected_event(<span class="keywordtype">bool</span> server_initiated, <a class="code" href="classbuffer__c.html">buffer_c</a> &custom_reason, <span class="keywordtype">int</span> code_reason);00277 00278 <span class="comment">//change "connect state" var</span>00279 <span class="keywordtype">void</span> set_connect_state(<span class="keywordtype">int</span> value) { connect_state = value; }00280 00281 <span class="comment">//the behavior (callback set)</span>00282 client_behavior_i *beh;00283 00284 <span class="comment">//the server address</span>00285 NLaddress serveraddr;00286 00287 <span class="comment">//updated when connect_state goes CCS_CONNECTED: the port on the server allocated for this client.</span>00288 NLushort game_packets_port;00289 00290 <span class="comment">//port of requests on the server (where the client connects)</span>00291 NLushort server_request_port;00292 00293 <span class="comment">//configurated port for channel listen, and port that the client is listening now (0 if none)</span>00294 <span class="keywordtype">int</span> channel_port, effective_channel_port;00295 00296 <span class="comment">//client station</span>00297 station_c station;00298 00299 <span class="comment">//client connection's "wished state"</span>00300 <span class="keyword">volatile</span> <span class="keywordtype">bool</span> want_connect; <span class="comment">//yes/no</span>00301 00302 <span class="comment">//client connection's current state</span>00303 atomic_counter_c connect_state; <span class="comment">// ENUM </span>00304 00305 <span class="comment">//if disconnection was started by the client (?)</span>00306 <span class="comment">// REVIEW (pre-version 1.2.0(CVS): throughout zig 1.0.0 ~ 1.1.x, this flag was ALWAYS FALSE and</span>00307 <span class="comment">// some code was using it in a test...</span>00308 <span class="keywordtype">bool</span> started_disconnection;00309 00310 <span class="comment">//the connecter thread</span>00311 <span class="comment">//NLthreadID thread_connect;</span>00312 <span class="comment">//thread_c<client_c> thread_connect; //-- created as detached, handle is local</span>00313 <span class="comment">//mutex_c thread_connect_mutex; //mutex for thread_connect</span>00314 atomic_counter_c connector_threads; <span class="comment">//a counter of active connector threads for the destructor.</span>00315 00316 <span class="comment">//the thread that reads stuff from the server</span>00317 <span class="comment">//NLthreadID thread_read;</span>00318 thread_c<client_c> thread_read;00319 <span class="keyword">volatile</span> <span class="keywordtype">bool</span> quit_reader_thread; <span class="comment">//flag for reader thread to know it should quit</span>00320 mutex_c thread_read_mutex; <span class="comment">//mutex for thread_read</span>00321 00322 <span class="comment">//data sent in every connect packet</span>00323 <a class="code" href="classbuffer__c.html">buffer_c</a> connect_data;00324 00325 <span class="comment">//time of last send_packet with reliables, minimum interval for sending reliables in packet</span>00326 <span class="keywordtype">double</span> last_send_reliables;00327 <span class="keywordtype">double</span> min_send_reliables_interval;00328 00329 <span class="comment">//counter of still-running channel listener threads</span>00330 atomic_counter_c chan_thread_count;00331 00332 <span class="comment">//threads priority assignment strategy</span>00333 <span class="keywordtype">int</span> threads_prio;00334 00335 <span class="comment">//NEW (ZIG v1.2.1): set to 'true' by enable_socket_polling_mode()</span>00336 <span class="keywordtype">bool</span> socket_polling_mode;00337 00338 <span class="comment">//NEW (ZIG v1.2.1): socket group for polling the single client socket (so we avoid blocking</span>00339 <span class="comment">// on station::read_packet() -- which can only be called if there is data to be read in </span>00340 <span class="comment">// the socket...... right?? )</span>00341 <span class="keywordtype">int</span> client_socket_group;00342 00343 <span class="comment">//NEW (ZIG v1.2.1): for running the connector code on poll_sockets() when socket_polling_mode==true</span>00344 <span class="comment">// connect packets left to send</span>00345 <span class="keywordtype">int</span> connect_packet_left_count;00346 00347 <span class="comment">//NEW (ZIG v1.2.1): for running the connector code on poll_sockets() when socket_polling_mode==true</span>00348 <span class="comment">// time to send next connect packet</span>00349 <span class="keywordtype">double</span> connect_packet_next_time;00350 00351 <span class="comment">//NEW (ZIG v1.2.1): when socket polling mode is enabled, save result of serverinfo requests instead </span>00352 <span class="comment">// of calling from the serverinfo thread. handle multiple stacks by encoding the results in a map.</span>00353 std::list<serverinfo_result_c*> serverinfo_callbacks;00354 mutex_c serverinfo_callbacks_mutex;00355 00356 <span class="comment">//NEW (ZIG v1.3.0): "disconnect code reason", for INTERNAL use (don't mix up with app's code_reason)</span>00357 <span class="comment">// 0 = catch-all, default, generic, non-specific disconnection reason (no internal reason)</span>00358 <span class="keywordtype">int</span> internal_disconnected_code_reason;00359 00360 <span class="comment">//the default send message policy configured by set_default_send_message_policy()</span>00361 <span class="keywordtype">int</span> default_send_message_policy;00362 00363 <span class="comment">//NEW (v1.3.4): custom "connect-to" timeout (in seconds/tries)</span>00364 <span class="keywordtype">int</span> connect_to_server_timeout;00365 };00366 00367 <span class="preprocessor">#endif</span>00368 <span class="preprocessor"></span>00369 <span class="preprocessor">#endif //#ifndef NO_DOXYGEN // internal class -- do not document</span>00370 <span class="preprocessor"></span></pre></div><hr><address style="align: right;"><small>Generated on Mon Jan 24 21:14:23 2005 for ZIG by<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.18 </small></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -