and look at the GS packet processBOOLGameserver::P Rocessloop (packet&rpkt) { if(false= = M_spdatalayer->Recv (RPKT))return true;//no data. if(rpkt.is_data) {if(!rpkt.data)return false; Gamechannel* PGC =m_vecchannel[rpkt.channel_id]; if(PGC) PGC->onreceivedata (Rpkt.data, rpkt.size);//callback GC related functionsm_livemgr.onlive (rpkt.channel_id); } Else { //Network EventsLink_stat stat =(Link_stat) rpkt.size; if(Stat = =link_stat::link_connected) {Gamechannel* PNEWGC =NewGamechannel (); PNEWGC->m_nchannelid =rpkt.channel_id; PNEWGC->m_pdatalayer = M_spdatalayer.Get();//M_PDATALAYER,GC Direct contract to clientPnewgc->m_pshare = This; PNEWGC->M_PASYNDBC = This->m_spasyndbc.Get();//GC deals directly with databasesm_vecchannel[rpkt.channel_id]=PNEWGC; M_livemgr.add (rpkt.channel_id); } Else if(stat = = Link_stat::link_disconnected | | stat = =link_stat::link_connect_failed) {Gamechannel* PDISCONNECTGC =m_vecchannel[rpkt.channel_id]; if(PDISCONNECTGC) {//If you enter the map, you will be called Push_freequeue + hysteresis m_channels[channel_id] When you save the character information .Pdisconnectgc->ondisconnect ();//To do the work of the character downline, the notification map, database access operations, etc., according to the player's state to//if the map is not in the offline, directly disconnected; Do not save role details, can be placed directly in the release queue if(!pdisconnectgc->m_pmap)//If entering the map you need to return data from map and then save the database{AUTOFREEGC (PDISCONNECTGC);//If no database access is released directly, or if no database access is placed into the queue, the release}} m_livemgr.remove (rpkt.channel_id); } } return false;}
And look at the GS packet process