``fix(socket): 将TCP剩余数据输出格式改为十六进制字符串``
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user