ing
This commit is contained in:
parent
7f7773d01b
commit
57065b83df
|
@ -16,12 +16,9 @@ func connReadHandler(readWriteHandler ReadWriteHandler, conn Conn, stopChan <-ch
|
||||||
doneChan <- err
|
doneChan <- err
|
||||||
}()
|
}()
|
||||||
|
|
||||||
if 0 < readWriteHandler.GetMaxMessageSize() {
|
|
||||||
conn.SetReadLimit(readWriteHandler.GetMaxMessageSize())
|
conn.SetReadLimit(readWriteHandler.GetMaxMessageSize())
|
||||||
}
|
|
||||||
if 0 < readWriteHandler.GetReadTimeout() {
|
|
||||||
conn.SetReadDeadline(time.Now().Add(readWriteHandler.GetReadTimeout()))
|
conn.SetReadDeadline(time.Now().Add(readWriteHandler.GetReadTimeout()))
|
||||||
}
|
|
||||||
conn.SetPongHandler(func(string) error {
|
conn.SetPongHandler(func(string) error {
|
||||||
conn.SetReadDeadline(time.Now().Add(readWriteHandler.GetPongTimeout()))
|
conn.SetReadDeadline(time.Now().Add(readWriteHandler.GetPongTimeout()))
|
||||||
return nil
|
return nil
|
||||||
|
@ -72,9 +69,7 @@ func connWriteHandler(readWriteHandler ReadWriteHandler, conn Conn, stopChan <-c
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case message, ok = <-writeChan:
|
case message, ok = <-writeChan:
|
||||||
if 0 < readWriteHandler.GetWriteTimeout() {
|
|
||||||
conn.SetWriteDeadline(time.Now().Add(readWriteHandler.GetWriteTimeout()))
|
conn.SetWriteDeadline(time.Now().Add(readWriteHandler.GetWriteTimeout()))
|
||||||
}
|
|
||||||
if !ok {
|
if !ok {
|
||||||
conn.WriteMessage(CloseMessage, []byte{})
|
conn.WriteMessage(CloseMessage, []byte{})
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue
Block a user