Commit d7df3f96 authored by AlexStocks's avatar AlexStocks

Fix: do not use juju/errors on read/write

parent f0b4eda9
......@@ -14,6 +14,10 @@
## develop history ##
---
- 2018/06/25
> buf fix
* delete juju/errors on read/write in case of network i/o timeout
- 2018/03/29
> improvement
* use juju/errors instead of pkg/errors
......
......@@ -29,7 +29,7 @@ import (
)
var (
launchTime time.Time = time.Now()
launchTime = time.Now()
// ErrInvalidConnection = errors.New("connection has been closed.")
)
......@@ -249,7 +249,8 @@ func (t *gettyTCPConn) read(p []byte) (int, error) {
length, err = t.reader.Read(p)
log.Debug("now:%s, length:%d, err:%s", currentTime, length, err)
atomic.AddUint32(&t.readBytes, uint32(length))
return length, jerrors.Trace(err)
//return length, jerrors.Trace(err)
return length, err
}
// tcp connection write
......@@ -282,7 +283,8 @@ func (t *gettyTCPConn) Write(pkg interface{}) (int, error) {
atomic.AddUint32(&t.writeBytes, (uint32)(len(p)))
}
log.Debug("now:%s, length:%d, err:%s", currentTime, length, err)
return length, jerrors.Trace(err)
//return length, jerrors.Trace(err)
return length, err
}
// close tcp connection
......@@ -400,7 +402,8 @@ func (u *gettyUDPConn) read(p []byte) (int, *net.UDPAddr, error) {
atomic.AddUint32(&u.readBytes, uint32(length))
}
return length, addr, jerrors.Trace(err)
return length, addr, err
// return length, addr, jerrors.Trace(err)
}
// write udp packet, @ctx should be of type UDPContext
......@@ -446,7 +449,8 @@ func (u *gettyUDPConn) Write(udpCtx interface{}) (int, error) {
}
log.Debug("WriteMsgUDP(peerAddr:%s) = {length:%d, error:%s}", peerAddr, length, err)
return length, jerrors.Trace(err)
// return length, jerrors.Trace(err)
return length, err
}
// close udp connection
......@@ -543,7 +547,8 @@ func (w *gettyWSConn) read() ([]byte, error) {
}
}
return b, jerrors.Trace(e)
// return b, jerrors.Trace(e)
return b, e
}
func (w *gettyWSConn) updateWriteDeadline() error {
......@@ -584,7 +589,8 @@ func (w *gettyWSConn) Write(pkg interface{}) (int, error) {
if err = w.conn.WriteMessage(websocket.BinaryMessage, p); err == nil {
atomic.AddUint32(&w.writeBytes, (uint32)(len(p)))
}
return len(p), jerrors.Trace(err)
// return len(p), jerrors.Trace(err)
return len(p), err
}
func (w *gettyWSConn) writePing() error {
......
......@@ -10,9 +10,9 @@
package getty
const (
Version = "0.8.3"
DATE = "2018/03/18"
Version = "0.8.4"
DATE = "2018/06/25"
GETTY_MAJOR = 0
GETTY_MINOR = 8
GETTY_BUILD = 3
GETTY_BUILD = 5
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment