1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-30 05:56:54 -05:00

log err on tcp test server

This commit is contained in:
Darien Raymond 2017-04-16 21:31:28 +02:00
parent 57a353e92f
commit 6515cf12e5
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -2,6 +2,7 @@ package tcp
import ( import (
"fmt" "fmt"
"io"
"net" "net"
v2net "v2ray.com/core/common/net" v2net "v2ray.com/core/common/net"
@ -54,13 +55,19 @@ func (server *Server) handleConnection(conn net.Conn) {
conn.Write(server.SendFirst) conn.Write(server.SendFirst)
} }
request := make([]byte, 4096) request := make([]byte, 4096)
for true { for {
nBytes, err := conn.Read(request) nBytes, err := conn.Read(request)
if err != nil { if err != nil {
if err != io.EOF {
fmt.Println("Failed to read request:", err)
}
break break
} }
response := server.MsgProcessor(request[:nBytes]) response := server.MsgProcessor(request[:nBytes])
conn.Write(response) if _, err := conn.Write(response); err != nil {
fmt.Println("Failed to write response:", err)
break
}
} }
conn.Close() conn.Close()
} }