summaryrefslogtreecommitdiff
path: root/cmd/util/rpc.go
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-09-26 22:31:59 +0300
committerWolfy-J <[email protected]>2018-09-26 22:31:59 +0300
commitb0dbc83dd5d1c542cffd240dc9343e841992c3fe (patch)
treebf5031318100ec429bfcc53387afed61a01a3f30 /cmd/util/rpc.go
parenta206fc3270ea6e469b1704f15f2f15a9f6a14bbd (diff)
improved debug handlers
Diffstat (limited to 'cmd/util/rpc.go')
-rw-r--r--cmd/util/rpc.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/cmd/util/rpc.go b/cmd/util/rpc.go
new file mode 100644
index 00000000..ee3414a6
--- /dev/null
+++ b/cmd/util/rpc.go
@@ -0,0 +1,18 @@
+package util
+
+import (
+ "errors"
+ "github.com/spiral/roadrunner/service"
+ rrpc "github.com/spiral/roadrunner/service/rpc"
+ "net/rpc"
+)
+
+// RPCClient returns RPC client associated with given roadrunner service container.
+func RPCClient(container service.Container) (*rpc.Client, error) {
+ svc, st := container.Get(rrpc.ID)
+ if st < service.StatusOK {
+ return nil, errors.New("RPC service is not configured")
+ }
+
+ return svc.(*rrpc.Service).Client()
+}