And look at the GS packet process

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.