mirror of https://github.com/bjdgyc/anylink.git
增加调试信息
This commit is contained in:
parent
62554cfba0
commit
4f9a1c0484
|
@ -15,7 +15,7 @@ import (
|
|||
func LinkCstp(conn net.Conn, bufRW *bufio.ReadWriter, cSess *sessdata.ConnSession) {
|
||||
base.Debug("LinkCstp connect ip:", cSess.IpAddr, "user:", cSess.Username, "rip:", conn.RemoteAddr())
|
||||
defer func() {
|
||||
base.Debug("LinkCstp return", cSess.IpAddr)
|
||||
base.Debug("LinkCstp return", cSess.Username, cSess.IpAddr)
|
||||
_ = conn.Close()
|
||||
cSess.Close()
|
||||
}()
|
||||
|
@ -34,14 +34,14 @@ func LinkCstp(conn net.Conn, bufRW *bufio.ReadWriter, cSess *sessdata.ConnSessio
|
|||
// 设置超时限制
|
||||
err = conn.SetReadDeadline(utils.NowSec().Add(dead))
|
||||
if err != nil {
|
||||
base.Error("SetDeadline: ", err)
|
||||
base.Error("SetDeadline: ", cSess.Username, err)
|
||||
return
|
||||
}
|
||||
// hdata := make([]byte, BufferSize)
|
||||
pl := getPayload()
|
||||
n, err = bufRW.Read(pl.Data)
|
||||
if err != nil {
|
||||
base.Error("read hdata: ", err)
|
||||
base.Error("read hdata: ", cSess.Username, err)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ func LinkCstp(conn net.Conn, bufRW *bufio.ReadWriter, cSess *sessdata.ConnSessio
|
|||
// base.Debug("recv keepalive", cSess.IpAddr)
|
||||
case 0x05: // DISCONNECT
|
||||
cSess.UserLogoutCode = dbdata.UserLogoutClient
|
||||
base.Debug("DISCONNECT", cSess.IpAddr)
|
||||
base.Debug("DISCONNECT", cSess.Username, cSess.IpAddr)
|
||||
return
|
||||
case 0x03: // DPD-REQ
|
||||
// base.Debug("recv DPD-REQ", cSess.IpAddr)
|
||||
|
@ -72,7 +72,7 @@ func LinkCstp(conn net.Conn, bufRW *bufio.ReadWriter, cSess *sessdata.ConnSessio
|
|||
dataLen = binary.BigEndian.Uint16(pl.Data[4:6]) // 4,5
|
||||
// 修复 cstp 数据长度溢出报错
|
||||
if 8+dataLen > BufferSize {
|
||||
base.Error("recv error dataLen", dataLen)
|
||||
base.Error("recv error dataLen", cSess.Username, dataLen)
|
||||
continue
|
||||
}
|
||||
// 去除数据头
|
||||
|
@ -89,7 +89,7 @@ func LinkCstp(conn net.Conn, bufRW *bufio.ReadWriter, cSess *sessdata.ConnSessio
|
|||
|
||||
func cstpWrite(conn net.Conn, bufRW *bufio.ReadWriter, cSess *sessdata.ConnSession) {
|
||||
defer func() {
|
||||
base.Debug("cstpWrite return", cSess.IpAddr)
|
||||
base.Debug("cstpWrite return", cSess.Username, cSess.IpAddr)
|
||||
_ = conn.Close()
|
||||
cSess.Close()
|
||||
}()
|
||||
|
@ -130,7 +130,7 @@ func cstpWrite(conn net.Conn, bufRW *bufio.ReadWriter, cSess *sessdata.ConnSessi
|
|||
|
||||
n, err = conn.Write(pl.Data)
|
||||
if err != nil {
|
||||
base.Error("write err", err)
|
||||
base.Error("write err", cSess.Username, err)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ func LinkDtls(conn net.Conn, cSess *sessdata.ConnSession) {
|
|||
}
|
||||
|
||||
defer func() {
|
||||
base.Debug("LinkDtls return", cSess.IpAddr)
|
||||
base.Debug("LinkDtls return", cSess.Username, cSess.IpAddr)
|
||||
_ = conn.Close()
|
||||
dSess.Close()
|
||||
}()
|
||||
|
@ -36,14 +36,14 @@ func LinkDtls(conn net.Conn, cSess *sessdata.ConnSession) {
|
|||
for {
|
||||
err = conn.SetReadDeadline(utils.NowSec().Add(dead))
|
||||
if err != nil {
|
||||
base.Error("SetDeadline: ", err)
|
||||
base.Error("SetDeadline: ", cSess.Username, err)
|
||||
return
|
||||
}
|
||||
|
||||
pl := getPayload()
|
||||
n, err = conn.Read(pl.Data)
|
||||
if err != nil {
|
||||
base.Error("read hdata: ", err)
|
||||
base.Error("read hdata: ", cSess.Username, err)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ func LinkDtls(conn net.Conn, cSess *sessdata.ConnSession) {
|
|||
// base.Debug("recv keepalive", cSess.IpAddr)
|
||||
case 0x05: // DISCONNECT
|
||||
cSess.UserLogoutCode = dbdata.UserLogoutClient
|
||||
base.Debug("DISCONNECT DTLS", cSess.IpAddr)
|
||||
base.Debug("DISCONNECT DTLS", cSess.Username, cSess.IpAddr)
|
||||
return
|
||||
case 0x03: // DPD-REQ
|
||||
// base.Debug("recv DPD-REQ", cSess.IpAddr)
|
||||
|
@ -85,7 +85,7 @@ func LinkDtls(conn net.Conn, cSess *sessdata.ConnSession) {
|
|||
|
||||
func dtlsWrite(conn net.Conn, dSess *sessdata.DtlsSession, cSess *sessdata.ConnSession) {
|
||||
defer func() {
|
||||
base.Debug("dtlsWrite return", cSess.IpAddr)
|
||||
base.Debug("dtlsWrite return", cSess.Username, cSess.IpAddr)
|
||||
_ = conn.Close()
|
||||
dSess.Close()
|
||||
}()
|
||||
|
@ -122,7 +122,7 @@ func dtlsWrite(conn net.Conn, dSess *sessdata.DtlsSession, cSess *sessdata.ConnS
|
|||
}
|
||||
n, err := conn.Write(pl.Data)
|
||||
if err != nil {
|
||||
base.Error("write err", err)
|
||||
base.Error("write err", cSess.Username, err)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue