File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ public class Channel {
4141 /// - Parameter address: the address of the server to be called
4242 /// - Parameter secure: if true, use TLS
4343 public init ( address: String , secure: Bool = true ) {
44+ gRPC. initialize ( )
4445 host = address
4546 if secure {
4647 underlyingChannel = cgrpc_channel_create_secure ( address, roots_pem ( ) , nil )
@@ -58,6 +59,7 @@ public class Channel {
5859 /// - Parameter certificates: a PEM representation of certificates to use
5960 /// - Parameter host: an optional hostname override
6061 public init ( address: String , certificates: String , host: String ? ) {
62+ gRPC. initialize ( )
6163 self . host = address
6264 underlyingChannel = cgrpc_channel_create_secure ( address, certificates, host)
6365 completionQueue = CompletionQueue (
Original file line number Diff line number Diff line change @@ -55,6 +55,13 @@ open class ServiceClientBase: ServiceClient {
5555 metadata = Metadata ( )
5656 }
5757
58+ /// Create a client using a pre-defined channel.
59+ public init ( channel: Channel ) {
60+ gRPC. initialize ( )
61+ self . channel = channel
62+ self . metadata = Metadata ( )
63+ }
64+
5865 /// Create a client that makes secure connections with a custom certificate and (optional) hostname.
5966 public init ( address: String , certificates: String , host: String ? ) {
6067 gRPC. initialize ( )
You can’t perform that action at this time.
0 commit comments