summaryrefslogtreecommitdiff
path: root/internal/protocol.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-08-09 17:10:07 +0300
committerValery Piashchynski <[email protected]>2021-08-09 17:10:07 +0300
commitfba3d927b62f8963f0c291da2739061e726df32e (patch)
tree37fd54198f1b4939c0b78435c22817ca0c5facd9 /internal/protocol.go
parent606e2170ccac5a13a11198aaf54e4219a83291ab (diff)
Update goridge to v3.2.0, update all frames operations.
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'internal/protocol.go')
-rwxr-xr-xinternal/protocol.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/internal/protocol.go b/internal/protocol.go
index 7487b4f3..78174118 100755
--- a/internal/protocol.go
+++ b/internal/protocol.go
@@ -39,8 +39,8 @@ func SendControl(rl relay.Relay, payload interface{}) error {
fr := getFrame()
defer putFrame(fr)
- fr.WriteVersion(frame.VERSION_1)
- fr.WriteFlags(frame.CONTROL)
+ fr.WriteVersion(fr.Header(), frame.VERSION_1)
+ fr.WriteFlags(fr.Header(), frame.CONTROL)
if data, ok := payload.([]byte); ok {
// check if payload no more that 4Gb
@@ -48,9 +48,9 @@ func SendControl(rl relay.Relay, payload interface{}) error {
return errors.E(op, errors.Str("payload is more that 4gb"))
}
- fr.WritePayloadLen(uint32(len(data)))
+ fr.WritePayloadLen(fr.Header(), uint32(len(data)))
fr.WritePayload(data)
- fr.WriteCRC()
+ fr.WriteCRC(fr.Header())
err := rl.Send(fr)
if err != nil {
@@ -64,9 +64,9 @@ func SendControl(rl relay.Relay, payload interface{}) error {
return errors.E(op, errors.Errorf("invalid payload: %s", err))
}
- fr.WritePayloadLen(uint32(len(data)))
+ fr.WritePayloadLen(fr.Header(), uint32(len(data)))
fr.WritePayload(data)
- fr.WriteCRC()
+ fr.WriteCRC(fr.Header())
// hold a pointer to a frame
// Do we need a copy here????
@@ -89,7 +89,7 @@ func FetchPID(rl relay.Relay) (int64, error) {
defer putFrame(fr)
err = rl.Receive(fr)
- if !fr.VerifyCRC() {
+ if !fr.VerifyCRC(fr.Header()) {
return 0, errors.E(op, errors.Str("CRC mismatch"))
}
if err != nil {