diff --git a/internal/jsonrpc/router.go b/internal/jsonrpc/router.go index fda698b..0534432 100644 --- a/internal/jsonrpc/router.go +++ b/internal/jsonrpc/router.go @@ -26,6 +26,8 @@ func NewJSONRPCRouter(writer io.Writer, handlers map[string]*RPCHandler) *JSONRP return &JSONRPCRouter{ writer: writer, handlers: handlers, + + responseChannels: make(map[int64]chan JSONRPCResponse), } } diff --git a/internal/plugin/rpc.go b/internal/plugin/rpc.go index ff31472..dacb1d8 100644 --- a/internal/plugin/rpc.go +++ b/internal/plugin/rpc.go @@ -96,7 +96,7 @@ func (s *PluginRpcServer) SocketPath() string { } func (s *PluginRpcServer) handleConnection(conn net.Conn) { - rpcserver := jsonrpc.NewJSONRPCServer(conn, map[string]*jsonrpc.RPCHandler{}) + rpcserver := jsonrpc.NewJSONRPCRouter(conn, map[string]*jsonrpc.RPCHandler{}) ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -129,7 +129,7 @@ func (s *PluginRpcServer) handleConnection(conn net.Conn) { } } -func (s *PluginRpcServer) handleRpcStatus(ctx context.Context, rpcserver *jsonrpc.JSONRPCServer) { +func (s *PluginRpcServer) handleRpcStatus(ctx context.Context, rpcserver *jsonrpc.JSONRPCRouter) { s.status = PluginRpcStatusUnknown log.Printf("Plugin rpc server started. Getting supported methods...")