starpc 0.27.0 → 0.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/go.mod CHANGED
@@ -9,7 +9,7 @@ require (
9
9
  )
10
10
 
11
11
  require (
12
- github.com/aperturerobotics/util v1.13.8 // latest
12
+ github.com/aperturerobotics/util v1.14.2 // latest
13
13
  github.com/libp2p/go-libp2p v0.33.0 // latest
14
14
  github.com/libp2p/go-yamux/v4 v4.0.2-0.20240206065824-7222fbc3459d // master
15
15
  github.com/sirupsen/logrus v1.9.3 // latest
@@ -34,7 +34,7 @@ require (
34
34
  github.com/multiformats/go-varint v0.0.7 // indirect
35
35
  github.com/spaolacci/murmur3 v1.1.0 // indirect
36
36
  golang.org/x/crypto v0.19.0 // indirect
37
- golang.org/x/exp v0.0.0-20240213143201-ec583247a57a // indirect
37
+ golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect
38
38
  golang.org/x/sys v0.17.0 // indirect
39
39
  lukechampine.com/blake3 v1.2.1 // indirect
40
40
  )
package/go.sum CHANGED
@@ -1,5 +1,5 @@
1
- github.com/aperturerobotics/util v1.13.8 h1:hpBfvD+afJg4Ox4iXpCRA+0LsOyftmV6/mAVU0uiG2w=
2
- github.com/aperturerobotics/util v1.13.8/go.mod h1:8AfpGb9RJqUItLBb5ec3sprpl9swYyHlgOw0HzkE+S8=
1
+ github.com/aperturerobotics/util v1.14.2 h1:AghqzGgZoufsdQstY6cCssHHMB/uCv8+BjysAE55S98=
2
+ github.com/aperturerobotics/util v1.14.2/go.mod h1:1+G2THhT7VCmR7xeRlqDnyEtRFvONWoPft19xTHvbyk=
3
3
  github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
4
4
  github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
5
5
  github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -57,8 +57,8 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU
57
57
  github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
58
58
  golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo=
59
59
  golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
60
- golang.org/x/exp v0.0.0-20240213143201-ec583247a57a h1:HinSgX1tJRX3KsL//Gxynpw5CTOAIPhgL4W8PNiIpVE=
61
- golang.org/x/exp v0.0.0-20240213143201-ec583247a57a/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc=
60
+ golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 h1:LfspQV/FYTatPTr/3HzIcmiUFH7PGP+OQ6mgDYo3yuQ=
61
+ golang.org/x/exp v0.0.0-20240222234643-814bf88cf225/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc=
62
62
  golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
63
63
  golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
64
64
  golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starpc",
3
- "version": "0.27.0",
3
+ "version": "0.27.1",
4
4
  "description": "Streaming protobuf RPC service protocol over any two-way channel.",
5
5
  "license": "MIT",
6
6
  "author": {
package/srpc/stream.go CHANGED
@@ -47,3 +47,27 @@ type StreamSendAndClose[T any] interface {
47
47
  StreamSend[T]
48
48
  SendAndClose(T) error
49
49
  }
50
+
51
+ // streamWithClose is a Stream with a wrapped Close function.
52
+ type streamWithClose struct {
53
+ Stream
54
+ closeFn func() error
55
+ }
56
+
57
+ // NewStreamWithClose wraps a Stream with a close function to call when Close is called.
58
+ func NewStreamWithClose(strm Stream, close func() error) Stream {
59
+ return &streamWithClose{Stream: strm, closeFn: close}
60
+ }
61
+
62
+ // Close closes the stream for reading and writing.
63
+ func (s *streamWithClose) Close() error {
64
+ err := s.Stream.Close()
65
+ err2 := s.closeFn()
66
+ if err != nil {
67
+ return err
68
+ }
69
+ return err2
70
+ }
71
+
72
+ // _ is a type assertion
73
+ var _ Stream = (*streamWithClose)(nil)