diff --git a/Client/CMH.lua b/Client/CMH.lua index 11a767b..57ba053 100644 --- a/Client/CMH.lua +++ b/Client/CMH.lua @@ -108,7 +108,7 @@ function CMH.OnReceive(self, event, prefix, _, Type, sender) if event == "CHAT_MSG_ADDON" and sender == UnitName("player") and Type == "WHISPER" then -- unpack and validate addon message structure local pfx, source, pckId, data = prefix:match("(...)(%u)(%d%d)(.+)") - if not pfx or not source or not pckId or not data then + if not pfx or not source or not pckId then return end @@ -186,7 +186,12 @@ function CMH.OnREQ(sender, data) CMH.SendACK(reqId) end -function CMH.OnACK(sender, reqId) +function CMH.OnACK(sender, data) + local reqId = data:match("(%w%w%w%w%w%w)"); + if not reqId then + return + end + -- We received ACK but no data is available in cache. This should never happen if not datacache[reqId] then debugOut("ACK received but no data available to transmit. Aborting.") @@ -255,7 +260,12 @@ function CMH.OnDAT(sender, data) end end -function CMH.OnNAK(sender, reqId) +function CMH.OnNAK(sender, data) + local reqId = data:match("(%w%w%w%w%w%w)"); + if not reqId then + return + end + -- when we receive an error from the server, purge the local cache data debugOut("Purging cache data with REQ ID: "..reqId) datacache[reqId] = nil diff --git a/Server/SMH.lua b/Server/SMH.lua index a5b3518..e2e6776 100644 --- a/Server/SMH.lua +++ b/Server/SMH.lua @@ -197,7 +197,12 @@ function SMH.OnREQ(sender, data) SMH.SendACK(sender, reqId) end -function SMH.OnACK(sender, reqId) +function SMH.OnACK(sender, data) + local reqId = data:match("(%w%w%w%w%w%w)"); + if not reqId then + return + end + -- We received ACK but no data is available in cache. This should never happen if not datacache[sender:GetGUIDLow()][reqId] then debugOut("ACK received but no data available to transmit. Aborting.") @@ -266,7 +271,12 @@ function SMH.OnDAT(sender, data) end end -function SMH.OnNAK(sender, reqId) +function SMH.OnNAK(sender, data) + local reqId = data:match("(%w%w%w%w%w%w)"); + if not reqId then + return + end + -- when we receive an error from the server, purge the local cache data debugOut("Purging cache data with REQ ID: "..reqId) datacache[sender:GetGUIDLow()][reqId] = nil