summaryrefslogtreecommitdiff
path: root/public/gcsdk/netpacketpool.h
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /public/gcsdk/netpacketpool.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'public/gcsdk/netpacketpool.h')
-rw-r--r--public/gcsdk/netpacketpool.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/public/gcsdk/netpacketpool.h b/public/gcsdk/netpacketpool.h
new file mode 100644
index 0000000..e78fdc8
--- /dev/null
+++ b/public/gcsdk/netpacketpool.h
@@ -0,0 +1,42 @@
+//====== Copyright (c), Valve Corporation, All rights reserved. =======
+//
+// Purpose:
+//
+//=============================================================================
+
+#ifndef GCNETPACKETPOOL_H
+#define GCNETPACKETPOOL_H
+
+#include "netpacket.h"
+
+namespace GCSDK
+{
+
+class CNetPacket;
+
+extern int g_cNetPacket;
+extern CThreadSafeMultiMemoryPool g_MemPoolMsg;
+
+
+class CNetPacketPool
+{
+public:
+
+#ifdef _SERVER
+ static int CMBPacketMemPool() { return ( CNetPacketPool::sm_MemPoolNetPacket.CubTotalSize() / k_nMegabyte ); }
+ static int CMBPacketMemPoolInUse() { return ( CNetPacketPool::sm_MemPoolNetPacket.CubSizeInUse() / k_nMegabyte ); }
+#endif // _SERVER
+
+ static CNetPacket *AllocNetPacket() { g_cNetPacket++; return sm_MemPoolNetPacket.Alloc(); }
+
+private:
+ friend class CNetPacket;
+
+ static CClassMemoryPool<CNetPacket> sm_MemPoolNetPacket;
+
+};
+
+
+} // namespace GCSDK
+
+#endif // GCNETPACKETPOOL_H