``fix(socket): 将TCP剩余数据输出格式改为十六进制字符串``

This commit is contained in:
1
2025-10-16 16:58:20 +00:00
parent 779cc522df
commit 52ea55ac39

View File

@@ -2,6 +2,7 @@ package socket
import (
"context"
"encoding/hex"
"fmt"
"log"
"os"
@@ -165,7 +166,8 @@ func (s *Server) handleTcp(conn gnet.Conn) (action gnet.Action) {
if conn.InboundBuffered() > 0 {
t, _ := conn.Peek(conn.InboundBuffered())
fmt.Println("剩余数据", conn.InboundBuffered(), string(t))
fmt.Println("剩余数据", conn.InboundBuffered(), hex.EncodeToString(t))
if err := conn.Wake(nil); err != nil { // wake up the connection manually to avoid missing the leftover data
logging.Errorf("failed to wake up the connection, %v", err)
return gnet.Close