Skip to content

Commit

Permalink
drpcwire: add back KindCancel for soft cancel support
Browse files Browse the repository at this point in the history
Change-Id: I285f9bd31b7fb1d3d20b7f4421e822d482afa421
  • Loading branch information
zeebo committed Nov 3, 2022
1 parent f550f63 commit 8ad4620
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 23 deletions.
3 changes: 3 additions & 0 deletions drpcwire/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ const (
// with a code attached.
KindError Kind = 3

// KindCancel is sent to notify the remote that we have soft canceled.
KindCancel Kind = 4

// KindClose is used to inform that the rpc is dead. It has no body.
KindClose Kind = 5

Expand Down
3 changes: 0 additions & 3 deletions drpcwire/fuzz_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build gofuzzbeta
// +build gofuzzbeta

// Copyright (C) 2021 Storj Labs, Inc.
// See LICENSE for copying information.

Expand Down
6 changes: 3 additions & 3 deletions drpcwire/packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ const (
// kindReserved is saved for the future in case we need to extend.
// kindReserved Kind = 0

// kindCancelDeprecated is a reminder that we once used this kind value.
// kindCancelDeprecated Kind = 4

// KindInvoke is used to invoke an rpc. The body is the name of the rpc.
KindInvoke Kind = 1

Expand All @@ -27,6 +24,9 @@ const (
// with a code attached.
KindError Kind = 3

// KindCancel is sent to notify the remote that we have soft canceled.
KindCancel Kind = 4

// KindClose is used to inform that the rpc is dead. It has no body.
KindClose Kind = 5

Expand Down
24 changes: 7 additions & 17 deletions drpcwire/packet_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions drpcwire/rand_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ var payloadSize = map[Kind]func() int{
KindInvoke: func() int { return rand.Intn(1023) + 1 },
KindMessage: func() int { return rand.Intn(1023) + 1 },
KindError: func() int { return rand.Intn(1023) + 1 },
KindCancel: func() int { return 0 },
KindClose: func() int { return 0 },
KindCloseSend: func() int { return 0 },
KindInvokeMetadata: func() int { return rand.Intn(1023) + 1 },
Expand Down

0 comments on commit 8ad4620

Please sign in to comment.