summaryrefslogtreecommitdiff
path: root/protocol.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2020-10-13 13:55:20 +0300
committerValery Piashchynski <[email protected]>2020-10-13 13:55:20 +0300
commit0dc44d54cfcc9dd3fa09a41136f35a9a8d26b994 (patch)
treeffcb65010bebe9f5b5436192979e64b2402a6ec0 /protocol.go
parent08d6b6b7f773f83b286cd48c1a0fbec9a62fb42b (diff)
Initial commit of RR 2.0v2.0.0-alpha1
Diffstat (limited to 'protocol.go')
-rw-r--r--protocol.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/protocol.go b/protocol.go
index b00eb2a4..bdf78296 100644
--- a/protocol.go
+++ b/protocol.go
@@ -2,11 +2,14 @@ package roadrunner
import (
"fmt"
+ "os"
+
json "github.com/json-iterator/go"
"github.com/spiral/goridge/v2"
- "os"
)
+var j = json.ConfigCompatibleWithStandardLibrary
+
type stopCommand struct {
Stop bool `json:"stop"`
}
@@ -20,7 +23,6 @@ func sendControl(rl goridge.Relay, v interface{}) error {
return rl.Send(data, goridge.PayloadControl|goridge.PayloadRaw)
}
- j := json.ConfigCompatibleWithStandardLibrary
data, err := j.Marshal(v)
if err != nil {
return fmt.Errorf("invalid payload: %s", err)
@@ -29,8 +31,9 @@ func sendControl(rl goridge.Relay, v interface{}) error {
return rl.Send(data, goridge.PayloadControl)
}
-func fetchPID(rl goridge.Relay) (pid int, err error) {
- if err := sendControl(rl, pidCommand{Pid: os.Getpid()}); err != nil {
+func fetchPID(rl goridge.Relay) (int64, error) {
+ err := sendControl(rl, pidCommand{Pid: os.Getpid()})
+ if err != nil {
return 0, err
}
@@ -47,5 +50,5 @@ func fetchPID(rl goridge.Relay) (pid int, err error) {
return 0, err
}
- return link.Pid, nil
+ return int64(link.Pid), nil
}