diff --git a/.gitignore b/.gitignore index 025f077..683c6f0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ TransX.exe -TransX \ No newline at end of file +TransX +server.log* +client.log* diff --git a/tscipher/cipher.go b/tscipher/cipher.go index a8436ee..89724ec 100644 --- a/tscipher/cipher.go +++ b/tscipher/cipher.go @@ -6,7 +6,6 @@ import ( "github.com/TransX/utils" "io" "net" - "runtime/debug" "strconv" "strings" ) @@ -55,7 +54,11 @@ func NewCarrier(conn net.Conn, cipher Cipher, cache []byte, id string) *Carrier func (this *Carrier) GetReceiveBuff() []byte { log.Debug("id %d receivebuff Get, len %d", this.AttachedTunnelID, len(this.receiveBuff)) - return this.receiveBuff + buff := this.receiveBuff + _b := make([]byte, len(buff), cap(buff)) + copy(_b, buff) + return _b + // return this.receiveBuff } func (this *Carrier) SetReceiveBuff(buff []byte) { @@ -169,7 +172,6 @@ func RowReceiveData(carrier *Carrier) (n int, err error) { func ReceiveData(carrier *Carrier) (n int, err error) { defer func() { if r := recover(); r != nil { - debug.PrintStack() log.Error("ReceiveData err %s", r) } }()