loopd+cli: set max gRPC message receive size

pull/140/head
Oliver Gugger 4 years ago
parent d446d68eeb
commit 26c0c17dbd
No known key found for this signature in database
GPG Key ID: 8E4256593F177720

@ -30,6 +30,10 @@ var (
maxRoutingFeeRate = int64(20000)
defaultSwapWaitTime = 30 * time.Minute
// maxMsgRecvSize is the largest message our client will receive. We
// set this to 200MiB atm.
maxMsgRecvSize = grpc.MaxCallRecvMsgSize(1 * 1024 * 1024 * 200)
)
func printJSON(resp interface{}) {
@ -233,6 +237,7 @@ func logSwap(swap *looprpc.SwapStatus) {
func getClientConn(address string) (*grpc.ClientConn, error) {
opts := []grpc.DialOption{
grpc.WithInsecure(),
grpc.WithDefaultCallOptions(maxMsgRecvSize),
}
conn, err := grpc.Dial(address, opts...)

@ -20,6 +20,12 @@ import (
"google.golang.org/grpc"
)
var (
// maxMsgRecvSize is the largest message our REST proxy will receive. We
// set this to 200MiB atm.
maxMsgRecvSize = grpc.MaxCallRecvMsgSize(1 * 1024 * 1024 * 200)
)
// listenerCfg holds closures used to retrieve listeners for the gRPC services.
type listenerCfg struct {
// grpcListener returns a listener to use for the gRPC server.
@ -113,7 +119,10 @@ func daemon(config *config, lisCfg *listenerCfg) error {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
mux := proxy.NewServeMux(customMarshalerOption)
proxyOpts := []grpc.DialOption{grpc.WithInsecure()}
proxyOpts := []grpc.DialOption{
grpc.WithInsecure(),
grpc.WithDefaultCallOptions(maxMsgRecvSize),
}
err = looprpc.RegisterSwapClientHandlerFromEndpoint(
ctx, mux, config.RPCListen, proxyOpts,
)

Loading…
Cancel
Save