MCPcopy Create free account
hub / github.com/crossuo/crossuo / OnPacket

Method OnPacket

src/Managers/PacketManager.cpp:667–719  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

665}
666
667void CPacketManager::OnPacket()
668{
669 uint32_t ticks = g_Ticks;
670 g_TotalRecvSize += (uint32_t)Size;
671 CPacketInfo &info = m_Packets[*Start];
672 if (info.save)
673 {
674#if defined(XUO_WINDOWS) // FIXME: localtime_s (use C++ if possible)
675 time_t rawtime;
676 struct tm timeinfo;
677 char buffer[80];
678
679 time(&rawtime);
680 localtime_s(&timeinfo, &rawtime);
681 strftime(buffer, sizeof(buffer), "%d-%m-%Y %H:%M:%S", &timeinfo);
682 DEBUG(
683 Network,
684 "--- ^(%d) r(+%zd => %d) %s Server:: %s",
685 ticks - g_LastPacketTime,
686 Size,
687 g_TotalRecvSize,
688 buffer,
689 info.Name);
690#else
691 DEBUG(
692 Network,
693 "--- ^(%d) r(+%zd => %d) Server:: %s",
694 ticks - g_LastPacketTime,
695 Size,
696 g_TotalRecvSize,
697 info.Name);
698#endif
699 DEBUG_DUMP(Network, "RECV:", Start, (int)Size);
700 }
701
702 g_LastPacketTime = ticks;
703 if (info.Direction != DIR_RECV && info.Direction != DIR_BOTH)
704 {
705 Info(Network, "message direction invalid: 0x%02X", *Start);
706 }
707 else if (g_PluginManager.PacketRecv(Start, (int)Size))
708 {
709 if (info.Handler != 0)
710 {
711 Ptr = Start + 1;
712 if (info.Size == 0)
713 {
714 Ptr += 2;
715 }
716 (this->*(info.Handler))();
717 }
718 }
719}
720
721void CPacketManager::SavePluginReceivePacket(uint8_t *buf, int size)
722{

Callers

nothing calls this directly

Calls 1

PacketRecvMethod · 0.80

Tested by

no test coverage detected