MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / enumReceive

Function enumReceive

engine/Poseidon/Network/NetTransportNet.cpp:692–804  ·  view source on GitHub ↗

Control (broadcast) data received by the enumerator and client...

Source from the content-addressed store, hash-verified

690 {
691 out->setDistant(distant);
692 }
693 out->setFlags(MSG_ALL_FLAGS, MSG_MAGIC_FLAG | (ch ? MSG_VIM_FLAG : MSG_FROM_BCAST_FLAG));
694 out->setData((unsigned8*)&app, sizeof(app));
695 out->send(true); // urgent message
696 }
697 if (ch)
698 { // initial hand-shake (to initialize band-width..).
699 ch->checkConnectivity(0);
700 }
701 }
702 break;
703
704 case MAGIC_RECONNECT_PLAYER: // reconnect player
705 if (msg->getLength() == sizeof(ReconnectPlayerPacket))
706 {
707 ReconnectPlayerPacket* rpp = (ReconnectPlayerPacket*)msg->getData();
708 _server->enterUsr();
709 RefD<NetChannel> ch;
710 ConnectResult result = CRError;
711 if (_server->users.get(rpp->playerNo, ch) && // player with this ID exists => reconnect it
712 ch->reconnect(distant) == nsOK)
713 {
714 result = CROK;
715 }
716 _server->leaveUsr();
717 // .. send either acknowledgement back to the user
718 AckPlayerPacket app;
719 app.magic = MAGIC_ACK_PLAYER;
720 app.result = result;
721 app.playerNo = rpp->playerNo;
722 Ref<NetMessage> out = NetMessagePool::pool()->newMessage(
723 sizeof(AckPlayerPacket), (result == CROK) ? (NetChannel*)ch : msg->getChannel());
724 if (out)
725 {
726 if (result != CROK)
727 {
728 out->setDistant(distant);
729 }
730 out->setFlags(MSG_ALL_FLAGS,
731 MSG_MAGIC_FLAG | ((result == CROK) ? MSG_VIM_FLAG : MSG_FROM_BCAST_FLAG));
732 out->setData((unsigned8*)&app, sizeof(app));
733 out->send(true); // urgent message
734 }
735 if (result == CROK)
736 { // initial hand-shake (to re-initialize band-width..).
737 ch->checkConnectivity(0);
738 }
739 }
740 break;
741 }
742
743 return nsNoMoreCallbacks;
744}
745
746// Control (broadcast) data received by the enumerator and client...
747NetStatus enumReceive(NetMessage* msg, NetStatus event, void* data)
748{
749 // thread-critical: sprintf(), AutoArray::Add(), strncpy()

Callers

nothing calls this directly

Calls 15

getClientPeerFunction · 0.85
getSystemTimeFunction · 0.85
getLengthMethod · 0.80
getFlagsMethod · 0.80
getDistantMethod · 0.80
getPeerIdMethod · 0.80
getSerialMethod · 0.80
getMessageTimeMethod · 0.80
getChannelMethod · 0.80
getDataMethod · 0.45
enterMethod · 0.45
SizeMethod · 0.45

Tested by

no test coverage detected