Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1260)

Side by Side Diff: src/pkg/net/http/export_test.go

Issue 10747044: code review 10747044: net/http: fix memory leak in Transport (Closed)
Patch Set: diff -r 56762832416a https://go.googlecode.com/hg/ Created 10 years, 9 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/pkg/net/http/transport.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Go Authors. All rights reserved. 1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // Bridge package to expose http internals to tests in the http_test 5 // Bridge package to expose http internals to tests in the http_test
6 // package. 6 // package.
7 7
8 package http 8 package http
9 9
10 import ( 10 import (
(...skipping 30 matching lines...) Expand all
41 if t.idleConn == nil { 41 if t.idleConn == nil {
42 return 0 42 return 0
43 } 43 }
44 conns, ok := t.idleConn[cacheKey] 44 conns, ok := t.idleConn[cacheKey]
45 if !ok { 45 if !ok {
46 return 0 46 return 0
47 } 47 }
48 return len(conns) 48 return len(conns)
49 } 49 }
50 50
51 func (t *Transport) IdleConnChMapSizeForTesting() int {
52 t.idleMu.Lock()
53 defer t.idleMu.Unlock()
54 return len(t.idleConnCh)
55 }
56
51 func NewTestTimeoutHandler(handler Handler, ch <-chan time.Time) Handler { 57 func NewTestTimeoutHandler(handler Handler, ch <-chan time.Time) Handler {
52 f := func() <-chan time.Time { 58 f := func() <-chan time.Time {
53 return ch 59 return ch
54 } 60 }
55 return &timeoutHandler{handler, f, ""} 61 return &timeoutHandler{handler, f, ""}
56 } 62 }
57 63
58 var DefaultUserAgent = defaultUserAgent 64 var DefaultUserAgent = defaultUserAgent
OLDNEW
« no previous file with comments | « no previous file | src/pkg/net/http/transport.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b