From 93cee1e07b39ecdb0df1ab420a0eda8d9a252ed5 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Sun, 3 May 2020 11:22:58 +0700 Subject: [PATCH] stop the deadline timer in Stream.Read and Write --- receive_stream.go | 1 + send_stream.go | 1 + 2 files changed, 2 insertions(+) diff --git a/receive_stream.go b/receive_stream.go index 9f06f21f..040e067c 100644 --- a/receive_stream.go +++ b/receive_stream.go @@ -132,6 +132,7 @@ func (s *receiveStream) readImpl(p []byte) (bool /*stream completed */, int, err } if deadlineTimer == nil { deadlineTimer = utils.NewTimer() + defer deadlineTimer.Stop() } deadlineTimer.Reset(deadline) } diff --git a/send_stream.go b/send_stream.go index 6c71f0b8..ba6e0a34 100644 --- a/send_stream.go +++ b/send_stream.go @@ -137,6 +137,7 @@ func (s *sendStream) Write(p []byte) (int, error) { } if deadlineTimer == nil { deadlineTimer = utils.NewTimer() + defer deadlineTimer.Stop() } deadlineTimer.Reset(deadline) }