1.remove debug
2.return a copy of this.receiveBuff Signed-off-by: dmy@lab <dmy@lab.com>
This commit is contained in:
parent
171d12146e
commit
af0b6302d8
|
|
@ -1,2 +1,4 @@
|
||||||
TransX.exe
|
TransX.exe
|
||||||
TransX
|
TransX
|
||||||
|
server.log*
|
||||||
|
client.log*
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import (
|
||||||
"github.com/TransX/utils"
|
"github.com/TransX/utils"
|
||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
"runtime/debug"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
@ -55,7 +54,11 @@ func NewCarrier(conn net.Conn, cipher Cipher, cache []byte, id string) *Carrier
|
||||||
|
|
||||||
func (this *Carrier) GetReceiveBuff() []byte {
|
func (this *Carrier) GetReceiveBuff() []byte {
|
||||||
log.Debug("id %d receivebuff Get, len %d", this.AttachedTunnelID, len(this.receiveBuff))
|
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) {
|
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) {
|
func ReceiveData(carrier *Carrier) (n int, err error) {
|
||||||
defer func() {
|
defer func() {
|
||||||
if r := recover(); r != nil {
|
if r := recover(); r != nil {
|
||||||
debug.PrintStack()
|
|
||||||
log.Error("ReceiveData err %s", r)
|
log.Error("ReceiveData err %s", r)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue