glua net monitor
1.0.0
대역폭을 디버그하고 최적화하는 데 도움이 되도록 나가고 들어오는 네트 메시지를 캡처하는 간단한 유틸리티입니다. Net 라이브러리와 더 이상 사용되지 않는 umsg 라이브러리를 모두 지원합니다(아직 사용하고 있다면 애드온을 업데이트하세요).
gLua-net-monitor
폴더를 garrysmod/addons
폴더에 놓으면 자동으로 작동됩니다.
net/umsg/bf_read 함수 재정의를 재정의하는 애드온이 작동하려면 기본 구현을 호출해야 합니다. net.Incoming
을 재정의하면 메시지 헤더가 작동해야 하므로 이 유틸리티가 들어오는 메시지 캡처를 중지할 수 있습니다.
기본적으로 hooks.lua
파일에는 디버깅을 위한 몇 가지 기본 구현이 포함되어 있습니다. 자유롭게 제거하십시오.
-- Called when a net message is started.
-- @ param msgName: name of the message that was started.
-- @ param funcInfo: info about the function that started the message.
hook . Add ( " OnNetMessageStarted " , " NetStarted " , function ( msgName , funcInfo ) end )
-- Called when a net message is captured, for both outgoing and incoming messages.
-- Keep your code fast in here! This is called for every net/umsg message.
-- @ param msg: The captured message, see NetMonitor.CapturedMessage
-- @ param funcInfo: For outgoing messages, the function who started the message.
hook . Add ( " OnNetMessageCaptured " , " NetCaptured " , function ( msg , funcInfo ) end )
-- Called when a net message is received but no receiving function is hooked.
-- This is likely an oversight of a developer, albeit a wasteful one.
-- @ param msg: The captured message, see NetMonitor.CapturedMessage
hook . Add ( " OnNetMessageIgnored " , " NetIgnored " , function ( msg ) end )
-- Called when a received net message does not read all the received data.
-- Not called for the usermessage lib messages.
-- Called after OnNetMessageCaptured & OnNetMessageIgnored
-- This means you or an addon on your server is wasting bandwidth!
-- @ param msg: The captured message, see NetMonitor.CapturedMessage
-- @note: The captured message data will contain a binary string dump of the remaining data.
hook . Add ( " OnNetMessageDumpedData " , " NetDumped " , function ( msg ) end )
-- Called when a net message is discarded due to starting another without finishing the current one.
-- @ param msg: The captured message which got discarded, likely missing some information.
-- @ param funcInfo: The info about the function which called the dicarded message's net.Start()
hook . Add ( " OnNetMessageDiscarded " , " NetDiscarded " , function ( msg , funcInfo ) end )
-- Called clientside when the server's registry is received.
hook . Add ( " OnNetRegistryUpdated " , " NetRegistryUpdate " , function () end )