aboutsummaryrefslogtreecommitdiffstats
path: root/p2p
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-08-20 04:50:54 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-08-20 04:50:54 +0800
commite2d44814a513e7a964797b1e3639343e6682a615 (patch)
tree8320092e4b9660e45cdfbcd284f6f841e3696b2d /p2p
parentbd3a44cac9664ff72584fb123b3348f24c62d066 (diff)
parent269c5c71072f9e17e6387f853d626bff1160db5c (diff)
downloadgo-tangerine-e2d44814a513e7a964797b1e3639343e6682a615.tar
go-tangerine-e2d44814a513e7a964797b1e3639343e6682a615.tar.gz
go-tangerine-e2d44814a513e7a964797b1e3639343e6682a615.tar.bz2
go-tangerine-e2d44814a513e7a964797b1e3639343e6682a615.tar.lz
go-tangerine-e2d44814a513e7a964797b1e3639343e6682a615.tar.xz
go-tangerine-e2d44814a513e7a964797b1e3639343e6682a615.tar.zst
go-tangerine-e2d44814a513e7a964797b1e3639343e6682a615.zip
Merge pull request #1694 from obscuren/hide-fdtrack
fdtrack: hide message
Diffstat (limited to 'p2p')
-rw-r--r--p2p/dial.go2
-rw-r--r--p2p/discover/udp.go3
-rw-r--r--p2p/metrics.go8
-rw-r--r--p2p/server.go3
4 files changed, 5 insertions, 11 deletions
diff --git a/p2p/dial.go b/p2p/dial.go
index 8b210bacd..0fd3a4cf5 100644
--- a/p2p/dial.go
+++ b/p2p/dial.go
@@ -23,7 +23,6 @@ import (
"net"
"time"
- "github.com/ethereum/go-ethereum/fdtrack"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/p2p/discover"
@@ -213,7 +212,6 @@ func (t *dialTask) Do(srv *Server) {
glog.V(logger.Detail).Infof("dial error: %v", err)
return
}
- fd = fdtrack.WrapConn("p2p", fd)
mfd := newMeteredConn(fd, false)
srv.setupConn(mfd, t.flags, t.dest)
diff --git a/p2p/discover/udp.go b/p2p/discover/udp.go
index 6aefb68f7..afb31ee69 100644
--- a/p2p/discover/udp.go
+++ b/p2p/discover/udp.go
@@ -26,7 +26,6 @@ import (
"time"
"github.com/ethereum/go-ethereum/crypto"
- "github.com/ethereum/go-ethereum/fdtrack"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/p2p/nat"
@@ -200,7 +199,6 @@ func ListenUDP(priv *ecdsa.PrivateKey, laddr string, natm nat.Interface, nodeDBP
if err != nil {
return nil, err
}
- fdtrack.Open("p2p")
conn, err := net.ListenUDP("udp", addr)
if err != nil {
return nil, err
@@ -238,7 +236,6 @@ func newUDP(priv *ecdsa.PrivateKey, c conn, natm nat.Interface, nodeDBPath strin
func (t *udp) close() {
close(t.closing)
- fdtrack.Close("p2p")
t.conn.Close()
// TODO: wait for the loops to end.
}
diff --git a/p2p/metrics.go b/p2p/metrics.go
index 8ee4ed04b..f98cac274 100644
--- a/p2p/metrics.go
+++ b/p2p/metrics.go
@@ -34,7 +34,7 @@ var (
// meteredConn is a wrapper around a network TCP connection that meters both the
// inbound and outbound network traffic.
type meteredConn struct {
- net.Conn
+ *net.TCPConn // Network connection to wrap with metering
}
// newMeteredConn creates a new metered connection, also bumping the ingress or
@@ -45,13 +45,13 @@ func newMeteredConn(conn net.Conn, ingress bool) net.Conn {
} else {
egressConnectMeter.Mark(1)
}
- return &meteredConn{conn}
+ return &meteredConn{conn.(*net.TCPConn)}
}
// Read delegates a network read to the underlying connection, bumping the ingress
// traffic meter along the way.
func (c *meteredConn) Read(b []byte) (n int, err error) {
- n, err = c.Conn.Read(b)
+ n, err = c.TCPConn.Read(b)
ingressTrafficMeter.Mark(int64(n))
return
}
@@ -59,7 +59,7 @@ func (c *meteredConn) Read(b []byte) (n int, err error) {
// Write delegates a network write to the underlying connection, bumping the
// egress traffic meter along the way.
func (c *meteredConn) Write(b []byte) (n int, err error) {
- n, err = c.Conn.Write(b)
+ n, err = c.TCPConn.Write(b)
egressTrafficMeter.Mark(int64(n))
return
}
diff --git a/p2p/server.go b/p2p/server.go
index d8be85323..6060adc71 100644
--- a/p2p/server.go
+++ b/p2p/server.go
@@ -25,7 +25,6 @@ import (
"sync"
"time"
- "github.com/ethereum/go-ethereum/fdtrack"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/p2p/discover"
@@ -373,7 +372,7 @@ func (srv *Server) startListening() error {
}
laddr := listener.Addr().(*net.TCPAddr)
srv.ListenAddr = laddr.String()
- srv.listener = fdtrack.WrapListener("p2p", listener)
+ srv.listener = listener
srv.loopWG.Add(1)
go srv.listenLoop()
// Map the TCP listening port if NAT is configured.