From 1ec53d689307da4b49d09ba264d73816d036bf94 Mon Sep 17 00:00:00 2001 From: onefang Date: Mon, 8 Jul 2019 13:35:18 +1000 Subject: Attempt to render "[LLUDPSERVER]: Malformed data, cannot parse" into something human readable as an aid to diagnosis. Beats hand translating the big block of hex codes it was spewing. --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index b575ed9..69239b1 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -32,6 +32,8 @@ using System.IO; using System.Net; using System.Net.Sockets; using System.Reflection; +using System.Text; +using System.Text.RegularExpressions; using System.Threading; using log4net; using Nini.Config; @@ -1311,8 +1313,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP { if (IncomingMalformedPacketCount < 100) { - m_log.WarnFormat("[LLUDPSERVER]: Malformed data, cannot parse {0} byte packet from {1}, data {2}:", - buffer.DataLength, buffer.RemoteEndPoint, Utils.BytesToHexString(buffer.Data, buffer.DataLength, null)); + m_log.WarnFormat("[LLUDPSERVER]: Malformed data, cannot parse {0} byte packet from {1}, data as hex {2}: {3}", + buffer.DataLength, buffer.RemoteEndPoint, Utils.BytesToHexString(buffer.Data, buffer.DataLength, null), + Regex.Replace(Encoding.UTF8.GetString(buffer.Data, 0, buffer.DataLength), @"\p{Cc}", a=>string.Format("[{0:X2}]", (byte)a.Value[0]))); } RecordMalformedInboundPacket(endPoint); -- cgit v1.1