ing
This commit is contained in:
parent
bbbdae8dcd
commit
5e42fbc185
|
@ -4,6 +4,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
logging "git.loafle.net/commons/logging-go"
|
||||||
)
|
)
|
||||||
|
|
||||||
func connReadHandler(readWriteHandler ReadWriteHandler, conn Conn, stopChan <-chan struct{}, doneChan chan<- error, readChan chan<- []byte) {
|
func connReadHandler(readWriteHandler ReadWriteHandler, conn Conn, stopChan <-chan struct{}, doneChan chan<- error, readChan chan<- []byte) {
|
||||||
|
@ -53,6 +55,7 @@ func connReadHandler(readWriteHandler ReadWriteHandler, conn Conn, stopChan <-ch
|
||||||
if IsUnexpectedCloseError(err, CloseGoingAway, CloseAbnormalClosure) {
|
if IsUnexpectedCloseError(err, CloseGoingAway, CloseAbnormalClosure) {
|
||||||
err = fmt.Errorf("Read error %v", err)
|
err = fmt.Errorf("Read error %v", err)
|
||||||
}
|
}
|
||||||
|
logging.Logger().Debug(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,11 +94,13 @@ func connWriteHandler(readWriteHandler ReadWriteHandler, conn Conn, stopChan <-c
|
||||||
|
|
||||||
wc, err = conn.NextWriter(TextMessage)
|
wc, err = conn.NextWriter(TextMessage)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
logging.Logger().Debug(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
wc.Write(message)
|
wc.Write(message)
|
||||||
|
|
||||||
if err = wc.Close(); nil != err {
|
if err = wc.Close(); nil != err {
|
||||||
|
logging.Logger().Debug(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
|
@ -105,6 +110,7 @@ func connWriteHandler(readWriteHandler ReadWriteHandler, conn Conn, stopChan <-c
|
||||||
conn.SetWriteDeadline(time.Time{})
|
conn.SetWriteDeadline(time.Time{})
|
||||||
}
|
}
|
||||||
if err = conn.WriteMessage(PingMessage, nil); nil != err {
|
if err = conn.WriteMessage(PingMessage, nil); nil != err {
|
||||||
|
logging.Logger().Debug(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
case <-stopChan:
|
case <-stopChan:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user