Skip to content

Commit

Permalink
generate client close funcs (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulwe authored Sep 21, 2024
1 parent ac39c85 commit 4963901
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions protoc-gen-psrpc/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,9 @@ func (t *psrpc) generateInterface(file *descriptor.FileDescriptorProto, service
t.P()
t.P(` // Close immediately, without waiting for pending RPCs`)
t.P(` Kill()`)
} else if iface == client {
t.P(` // Close immediately, without waiting for pending RPCs`)
t.P(` Close()`)
}
t.P(`}`)
}
Expand Down Expand Up @@ -554,6 +557,11 @@ func (t *psrpc) generateClient(service *descriptor.ServiceDescriptorProto) {
t.P(`}`)
t.P()
}

t.P(`func (s *`, structName, servTopics.FormatTypeParams(), `) Close() {`)
t.P(` s.client.Close()`)
t.P(`}`)
t.P()
}

func (t *psrpc) generateServerImplSignature(method *descriptor.MethodDescriptorProto, opts *options.Options) {
Expand Down
4 changes: 2 additions & 2 deletions version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
package version

const (
Version = "v0.5.1"
PsrpcVersion_0_5 = true
Version = "v0.6.0"
PsrpcVersion_0_6 = true
)

0 comments on commit 4963901

Please sign in to comment.