diff --git a/README.md b/README.md index 541faba3..df0493fa 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ deploying SingularityNET services using SingularityNET Daemon should install the $ go get -u github.com/golang/protobuf/protoc-gen-go ``` -* install [grpc] +* install [grpc] `grpc version > 1.25` ```bash $ go get -u google.golang.org/grpc ``` @@ -234,6 +234,7 @@ see [logger configuration](./logger/README.md) The default value set is to 4 (units are in MB ), this is used to configure the max size in MB of the message received by the Daemon. In case of Large messages , it is recommended to use streaming than setting a very high value on this configuration. It is not recommended to set the value more than 4GB +`Please make sure your grpc version > 1.25` * **metering_enabled** (optional,default: `false`) - This is used to define if metering needs to be enabled or not .You will need to define a valid ` metering_end_point` diff --git a/handler/grpc.go b/handler/grpc.go index 0b83c683..ef3cf5c7 100644 --- a/handler/grpc.go +++ b/handler/grpc.go @@ -25,6 +25,7 @@ var grpcDesc = &grpc.StreamDesc{ServerStreams: true, ClientStreams: true} type grpcHandler struct { grpcConn *grpc.ClientConn + options grpc.DialOption enc string passthroughEndpoint string executable string @@ -41,6 +42,9 @@ func NewGrpcHandler(serviceMetadata *blockchain.ServiceMetadata) grpc.StreamHand enc: serviceMetadata.GetWireEncoding(), passthroughEndpoint: config.GetString(config.PassthroughEndpointKey), executable: config.GetString(config.ExecutablePathKey), + options: grpc.WithDefaultCallOptions( + grpc.MaxCallRecvMsgSize(config.GetInt(config.MaxMessageSizeInMB)*1024*1024), + grpc.MaxCallSendMsgSize(config.GetInt(config.MaxMessageSizeInMB)*1024*1024)), } switch serviceMetadata.GetServiceType() { @@ -50,7 +54,7 @@ func NewGrpcHandler(serviceMetadata *blockchain.ServiceMetadata) grpc.StreamHand log.WithError(err).Panic("error parsing passthrough endpoint") } - conn, err := grpc.Dial(passthroughURL.Host, grpc.WithInsecure()) + conn, err := grpc.Dial(passthroughURL.Host, grpc.WithInsecure(), h.options) if err != nil { log.WithError(err).Panic("error dialing service") }