read ping

This commit is contained in:
Anton Kaliaev
2018-01-10 20:24:31 -06:00
parent b28b76ddf7
commit 5834a59816
2 changed files with 6 additions and 1 deletions

View File

@@ -332,7 +332,7 @@ FOR_LOOP:
c.Logger.Debug("Send Ping")
wire.WriteByte(packetTypePing, c.bufWriter, &n, &err)
c.sendMonitor.Update(int(n))
go c.flush()
c.flush()
c.Logger.Debug("Starting pong timer")
c.pongTimer.Reset(c.config.pongTimeout)
case <-c.pongTimer.C:

View File

@@ -137,6 +137,11 @@ func TestPongTimeoutResultsInError(t *testing.T) {
require.Nil(t, err)
defer mconn.Stop()
go func() {
// read ping
server.Read(make([]byte, 1))
}()
expectErrorAfter := 10*time.Millisecond + mconn.config.pingInterval + mconn.config.pongTimeout
select {
case msgBytes := <-receivedCh: