diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-08-04 18:51:16 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-08-04 18:51:16 +0800 |
commit | b01f2c29ae48dba0ba4a90a4c6dbbadfc313f5b1 (patch) | |
tree | 00ab530e6f28230400a65ebae7a4610f94cc1f80 /Godeps | |
parent | ff66e8fa2935d59d5104e324861d9e1bb517ffaa (diff) | |
parent | 5c949d3b3ba81ea0563575b19a7b148aeac4bf61 (diff) | |
download | go-tangerine-b01f2c29ae48dba0ba4a90a4c6dbbadfc313f5b1.tar go-tangerine-b01f2c29ae48dba0ba4a90a4c6dbbadfc313f5b1.tar.gz go-tangerine-b01f2c29ae48dba0ba4a90a4c6dbbadfc313f5b1.tar.bz2 go-tangerine-b01f2c29ae48dba0ba4a90a4c6dbbadfc313f5b1.tar.lz go-tangerine-b01f2c29ae48dba0ba4a90a4c6dbbadfc313f5b1.tar.xz go-tangerine-b01f2c29ae48dba0ba4a90a4c6dbbadfc313f5b1.tar.zst go-tangerine-b01f2c29ae48dba0ba4a90a4c6dbbadfc313f5b1.zip |
Merge pull request #1574 from fjl/fdtrack
fdtrack: hack to track file descriptor usage
Diffstat (limited to 'Godeps')
4 files changed, 27 insertions, 0 deletions
diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/httpu/httpu.go b/Godeps/_workspace/src/github.com/huin/goupnp/httpu/httpu.go index 862c3def4..3f4606af0 100644 --- a/Godeps/_workspace/src/github.com/huin/goupnp/httpu/httpu.go +++ b/Godeps/_workspace/src/github.com/huin/goupnp/httpu/httpu.go @@ -9,6 +9,8 @@ import ( "net/http" "sync" "time" + + "github.com/ethereum/go-ethereum/fdtrack" ) // HTTPUClient is a client for dealing with HTTPU (HTTP over UDP). Its typical @@ -25,6 +27,7 @@ func NewHTTPUClient() (*HTTPUClient, error) { if err != nil { return nil, err } + fdtrack.Open("upnp") return &HTTPUClient{conn: conn}, nil } @@ -33,6 +36,7 @@ func NewHTTPUClient() (*HTTPUClient, error) { func (httpu *HTTPUClient) Close() error { httpu.connLock.Lock() defer httpu.connLock.Unlock() + fdtrack.Close("upnp") return httpu.conn.Close() } diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/soap/soap.go b/Godeps/_workspace/src/github.com/huin/goupnp/soap/soap.go index 815610734..786ce6fa8 100644 --- a/Godeps/_workspace/src/github.com/huin/goupnp/soap/soap.go +++ b/Godeps/_workspace/src/github.com/huin/goupnp/soap/soap.go @@ -7,9 +7,12 @@ import ( "encoding/xml" "fmt" "io/ioutil" + "net" "net/http" "net/url" "reflect" + + "github.com/ethereum/go-ethereum/fdtrack" ) const ( @@ -26,6 +29,17 @@ type SOAPClient struct { func NewSOAPClient(endpointURL url.URL) *SOAPClient { return &SOAPClient{ EndpointURL: endpointURL, + HTTPClient: http.Client{ + Transport: &http.Transport{ + Dial: func(network, addr string) (net.Conn, error) { + c, err := net.Dial(network, addr) + if c != nil { + c = fdtrack.WrapConn("upnp", c) + } + return c, err + }, + }, + }, } } diff --git a/Godeps/_workspace/src/github.com/jackpal/go-nat-pmp/natpmp.go b/Godeps/_workspace/src/github.com/jackpal/go-nat-pmp/natpmp.go index 8ce4e8342..b165c784e 100644 --- a/Godeps/_workspace/src/github.com/jackpal/go-nat-pmp/natpmp.go +++ b/Godeps/_workspace/src/github.com/jackpal/go-nat-pmp/natpmp.go @@ -5,6 +5,8 @@ import ( "log" "net" "time" + + "github.com/ethereum/go-ethereum/fdtrack" ) // Implement the NAT-PMP protocol, typically supported by Apple routers and open source @@ -102,6 +104,8 @@ func (n *Client) rpc(msg []byte, resultSize int) (result []byte, err error) { if err != nil { return } + fdtrack.Open("natpmp") + defer fdtrack.Close("natpmp") defer conn.Close() result = make([]byte, resultSize) diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage/file_storage.go b/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage/file_storage.go index 46cc9d070..6d44f74b3 100644 --- a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage/file_storage.go +++ b/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage/file_storage.go @@ -18,6 +18,7 @@ import ( "sync" "time" + "github.com/ethereum/go-ethereum/fdtrack" "github.com/syndtr/goleveldb/leveldb/util" ) @@ -369,6 +370,8 @@ func (fw fileWrap) Close() error { err := fw.File.Close() if err != nil { f.fs.log(fmt.Sprintf("close %s.%d: %v", f.Type(), f.Num(), err)) + } else { + fdtrack.Close("leveldb") } return err } @@ -400,6 +403,7 @@ func (f *file) Open() (Reader, error) { return nil, err } ok: + fdtrack.Open("leveldb") f.open = true f.fs.open++ return fileWrap{of, f}, nil @@ -418,6 +422,7 @@ func (f *file) Create() (Writer, error) { if err != nil { return nil, err } + fdtrack.Open("leveldb") f.open = true f.fs.open++ return fileWrap{of, f}, nil |