aboutsummaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-08-03 08:45:33 +0800
committerFelix Lange <fjl@twurst.com>2015-08-04 09:10:27 +0800
commit5c949d3b3ba81ea0563575b19a7b148aeac4bf61 (patch)
tree05b9bbc8b837081cde166694d040ca1d9c972f45 /rpc
parentbf48ed32dd8be6bec2931c9f1eee4fd749affa21 (diff)
downloaddexon-5c949d3b3ba81ea0563575b19a7b148aeac4bf61.tar
dexon-5c949d3b3ba81ea0563575b19a7b148aeac4bf61.tar.gz
dexon-5c949d3b3ba81ea0563575b19a7b148aeac4bf61.tar.bz2
dexon-5c949d3b3ba81ea0563575b19a7b148aeac4bf61.tar.lz
dexon-5c949d3b3ba81ea0563575b19a7b148aeac4bf61.tar.xz
dexon-5c949d3b3ba81ea0563575b19a7b148aeac4bf61.tar.zst
dexon-5c949d3b3ba81ea0563575b19a7b148aeac4bf61.zip
fdtrack: temporary hack for tracking file descriptor usage
Package fdtrack logs statistics about open file descriptors. This should help identify the source of #1549.
Diffstat (limited to 'rpc')
-rw-r--r--rpc/comms/http.go2
-rw-r--r--rpc/comms/ipc_unix.go6
2 files changed, 6 insertions, 2 deletions
diff --git a/rpc/comms/http.go b/rpc/comms/http.go
index c165aa27e..c08b744a1 100644
--- a/rpc/comms/http.go
+++ b/rpc/comms/http.go
@@ -29,6 +29,7 @@ import (
"io"
"io/ioutil"
+ "github.com/ethereum/go-ethereum/fdtrack"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/rpc/codec"
@@ -177,6 +178,7 @@ func listenHTTP(addr string, h http.Handler) (*stopServer, error) {
if err != nil {
return nil, err
}
+ l = fdtrack.WrapListener("rpc", l)
s := &stopServer{l: l, idle: make(map[net.Conn]struct{})}
s.Server = &http.Server{
Addr: addr,
diff --git a/rpc/comms/ipc_unix.go b/rpc/comms/ipc_unix.go
index aff90cfaa..432bf93b5 100644
--- a/rpc/comms/ipc_unix.go
+++ b/rpc/comms/ipc_unix.go
@@ -22,6 +22,7 @@ import (
"net"
"os"
+ "github.com/ethereum/go-ethereum/fdtrack"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/rpc/codec"
@@ -50,15 +51,16 @@ func (self *ipcClient) reconnect() error {
func startIpc(cfg IpcConfig, codec codec.Codec, api shared.EthereumApi) error {
os.Remove(cfg.Endpoint) // in case it still exists from a previous run
- l, err := net.ListenUnix("unix", &net.UnixAddr{Name: cfg.Endpoint, Net: "unix"})
+ l, err := net.Listen("unix", cfg.Endpoint)
if err != nil {
return err
}
+ l = fdtrack.WrapListener("ipc", l)
os.Chmod(cfg.Endpoint, 0600)
go func() {
for {
- conn, err := l.AcceptUnix()
+ conn, err := l.Accept()
if err != nil {
glog.V(logger.Error).Infof("Error accepting ipc connection - %v\n", err)
continue