From 8a3db71ad50045605e22546907c8d9586a202320 Mon Sep 17 00:00:00 2001 From: Derek Collison Date: Mon, 1 Jul 2019 08:47:13 -0700 Subject: [PATCH] Updates from comments Signed-off-by: Derek Collison --- server/client.go | 4 ++-- test/ping_test.go | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/server/client.go b/server/client.go index cfa0103b..75347295 100644 --- a/server/client.go +++ b/server/client.go @@ -1463,7 +1463,7 @@ func (c *client) processPing() { c.sendPong() // Record this to suppress us sending one if this - // is withing a given time interval for activity. + // is within a given time interval for activity. c.ping.last = time.Now() // If not a CLIENT, we are done @@ -2666,7 +2666,7 @@ func (c *client) processPingTimer() { } // Lock should be held -// We Randomize the first one by an offset up to 20%, e.g. 2m ~= max 24s. +// We randomize the first one by an offset up to 20%, e.g. 2m ~= max 24s. // This is because the clients by default are usually setting same interval // and we have alot of cross ping/pongs between clients and servers. // We will now suppress the server ping/pong if we have received a client ping. diff --git a/test/ping_test.go b/test/ping_test.go index 8807450c..e43a7cc6 100644 --- a/test/ping_test.go +++ b/test/ping_test.go @@ -223,6 +223,7 @@ func TestPingSuppresion(t *testing.T) { send("PING\r\n") expect(pongRe) - // This will wait for + // This will wait for the time period where a PING should have fired + // and been delivered. We expect nothing here since it should be suppressed. expectNothingTimeout(t, c, time.Now().Add(100*time.Millisecond)) }