|
@@ -360,8 +360,13 @@ func (s *Session) waitForSendErr(hdr header, body io.Reader, errCh chan error) e
|
|
|
// the send happens right here, we enforce the connection write timeout if we
|
|
|
// can't queue the header to be sent.
|
|
|
func (s *Session) sendNoWait(hdr header) error {
|
|
|
- timer := time.NewTimer(s.config.ConnectionWriteTimeout)
|
|
|
- defer timer.Stop()
|
|
|
+ t := timerPool.Get()
|
|
|
+ timer := t.(*time.Timer)
|
|
|
+ timer.Reset(s.config.ConnectionWriteTimeout)
|
|
|
+ defer func() {
|
|
|
+ timer.Stop()
|
|
|
+ timerPool.Put(t)
|
|
|
+ }()
|
|
|
|
|
|
select {
|
|
|
case s.sendCh <- sendReady{Hdr: hdr}:
|