aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/comms/ipc_unix.go
diff options
context:
space:
mode:
authorBas van Kervel <bas@ethdev.com>2015-08-07 15:56:49 +0800
committerBas van Kervel <bas@ethdev.com>2015-08-12 18:22:16 +0800
commitf9cbd16f27e393d4937354ee31435e0a2f689484 (patch)
tree0b9668443084923b2b264cd0fb1b1b8c604cf1d6 /rpc/comms/ipc_unix.go
parent2fcf7f1241648dc2c0ed90a122c5945f25b3ce1a (diff)
downloaddexon-f9cbd16f27e393d4937354ee31435e0a2f689484.tar
dexon-f9cbd16f27e393d4937354ee31435e0a2f689484.tar.gz
dexon-f9cbd16f27e393d4937354ee31435e0a2f689484.tar.bz2
dexon-f9cbd16f27e393d4937354ee31435e0a2f689484.tar.lz
dexon-f9cbd16f27e393d4937354ee31435e0a2f689484.tar.xz
dexon-f9cbd16f27e393d4937354ee31435e0a2f689484.tar.zst
dexon-f9cbd16f27e393d4937354ee31435e0a2f689484.zip
support for user agents
Diffstat (limited to 'rpc/comms/ipc_unix.go')
-rw-r--r--rpc/comms/ipc_unix.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/rpc/comms/ipc_unix.go b/rpc/comms/ipc_unix.go
index 432bf93b5..6968fa844 100644
--- a/rpc/comms/ipc_unix.go
+++ b/rpc/comms/ipc_unix.go
@@ -48,7 +48,7 @@ func (self *ipcClient) reconnect() error {
return err
}
-func startIpc(cfg IpcConfig, codec codec.Codec, api shared.EthereumApi) error {
+func startIpc(cfg IpcConfig, codec codec.Codec, initializer func(conn net.Conn) (shared.EthereumApi, error)) error {
os.Remove(cfg.Endpoint) // in case it still exists from a previous run
l, err := net.Listen("unix", cfg.Endpoint)
@@ -69,6 +69,13 @@ func startIpc(cfg IpcConfig, codec codec.Codec, api shared.EthereumApi) error {
id := newIpcConnId()
glog.V(logger.Debug).Infof("New IPC connection with id %06d started\n", id)
+ api, err := initializer(conn)
+ if err != nil {
+ glog.V(logger.Error).Infof("Unable to initialize IPC connection - %v\n", err)
+ conn.Close()
+ continue
+ }
+
go handle(id, conn, api, codec)
}