From c4b9641a5e1afd9229afbf8684cf510e3efd2021 Mon Sep 17 00:00:00 2001 From: shy Date: Fri, 27 Sep 2024 23:58:19 +0800 Subject: [PATCH] add some --- base/web/space.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/base/web/space.go b/base/web/space.go index 4867d1d3..4e2dac71 100644 --- a/base/web/space.go +++ b/base/web/space.go @@ -138,7 +138,7 @@ func _space_handle(m *ice.Message, safe bool, name string, c *websocket.Conn) { kit.If(msg.Option(ice.MSG_USERROLE), func() { msg.Option(ice.MSG_USERROLE, aaa.VOID) }) } source, target := kit.Simple(msg.Optionv(ice.MSG_SOURCE), name), kit.Simple(msg.Optionv(ice.MSG_TARGET)) - msg.Log(kit.Select(tcp.RECV, tcp.ECHO, msg.Option(ice.MSG_HANDLE) == ice.TRUE), "%v->%v %v %v", source, target, msg.Detailv(), msg.FormatMeta()) + msg.Log(kit.Select(tcp.RECV, tcp.ECHO, msg.Option(ice.MSG_HANDLE) == ice.TRUE), "%d %v->%v %v %v", len(b), source, target, msg.Detailv(), msg.FormatMeta()) if next := msg.Option(ice.MSG_TARGET); next == "" || len(target) == 0 { msg.Go(func() { if k := kit.Keys(msg.Option(ice.MSG_USERPOD), "_token"); msg.Option(k) != "" { @@ -226,9 +226,12 @@ func _space_exec(m *ice.Message, name string, source, target []string, c *websoc } func _space_echo(m *ice.Message, source, target []string, c *websocket.Conn) { defer func() { m.WarnNotValid(recover()) }() - if m.Options(ice.MSG_SOURCE, source, ice.MSG_TARGET, target[1:]); !m.WarnNotValid(c.WriteMessage(1, []byte(m.FormatMeta()))) { + m.Options(ice.MSG_SOURCE, source, ice.MSG_TARGET, target[1:]) + data := m.FormatMeta() + if !m.WarnNotValid(c.WriteMessage(1, []byte(data))) { if source != nil { - m.Log(kit.Select(tcp.SEND, tcp.DONE, m.Option(ice.MSG_HANDLE) == ice.TRUE), "%v->%v %v %v", source, target, kit.ReplaceAll(kit.Format("%v", m.Detailv()), "\r\n", "\\r\\n", "\t", "\\t", "\n", "\\n"), m.FormatMeta()) + m.Log(kit.Select(tcp.SEND, tcp.DONE, m.Option(ice.MSG_HANDLE) == ice.TRUE), "%d %v->%v %v %v", len(data), source, target, + kit.ReplaceAll(kit.Format("%v", m.Detailv()), "\r\n", "\\r\\n", "\t", "\\t", "\n", "\\n"), data) } } }