aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/ipc.go
diff options
context:
space:
mode:
Diffstat (limited to 'rpc/ipc.go')
-rw-r--r--rpc/ipc.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/rpc/ipc.go b/rpc/ipc.go
index 4cce1cf74..ad8ce0309 100644
--- a/rpc/ipc.go
+++ b/rpc/ipc.go
@@ -25,17 +25,17 @@ import (
)
// ServeListener accepts connections on l, serving JSON-RPC on them.
-func (srv *Server) ServeListener(l net.Listener) error {
+func (s *Server) ServeListener(l net.Listener) error {
for {
conn, err := l.Accept()
if netutil.IsTemporaryError(err) {
- log.Warn("IPC accept error", "err", err)
+ log.Warn("RPC accept error", "err", err)
continue
} else if err != nil {
return err
}
- log.Trace("IPC accepted connection")
- go srv.ServeCodec(NewJSONCodec(conn), OptionMethodInvocation|OptionSubscriptions)
+ log.Trace("Accepted RPC connection", "conn", conn.RemoteAddr())
+ go s.ServeCodec(NewJSONCodec(conn), OptionMethodInvocation|OptionSubscriptions)
}
}
@@ -46,7 +46,11 @@ func (srv *Server) ServeListener(l net.Listener) error {
// The context is used for the initial connection establishment. It does not
// affect subsequent interactions with the client.
func DialIPC(ctx context.Context, endpoint string) (*Client, error) {
- return newClient(ctx, func(ctx context.Context) (net.Conn, error) {
- return newIPCConnection(ctx, endpoint)
+ return newClient(ctx, func(ctx context.Context) (ServerCodec, error) {
+ conn, err := newIPCConnection(ctx, endpoint)
+ if err != nil {
+ return nil, err
+ }
+ return NewJSONCodec(conn), err
})
}