From a3125c7b613acd22c1da385e4dc273861955a6f8 Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Thu, 25 Nov 2021 09:46:04 -0400 Subject: [PATCH] fix: increase response read limit (#169) --- waku/v2/protocol/filter/waku_filter.go | 3 ++- waku/v2/protocol/lightpush/waku_lightpush.go | 5 +++-- waku/v2/protocol/store/waku_store.go | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/waku/v2/protocol/filter/waku_filter.go b/waku/v2/protocol/filter/waku_filter.go index c98a180a..401fe17c 100644 --- a/waku/v2/protocol/filter/waku_filter.go +++ b/waku/v2/protocol/filter/waku_filter.go @@ -5,6 +5,7 @@ import ( "encoding/hex" "errors" "fmt" + "math" "sync" logging "github.com/ipfs/go-log" @@ -95,7 +96,7 @@ func (wf *WakuFilter) onRequest(s network.Stream) { filterRPCRequest := &pb.FilterRPC{} - reader := protoio.NewDelimitedReader(s, 64*1024) + reader := protoio.NewDelimitedReader(s, math.MaxInt64) err := reader.ReadMsg(filterRPCRequest) if err != nil { diff --git a/waku/v2/protocol/lightpush/waku_lightpush.go b/waku/v2/protocol/lightpush/waku_lightpush.go index 290fa670..e4b3ec7e 100644 --- a/waku/v2/protocol/lightpush/waku_lightpush.go +++ b/waku/v2/protocol/lightpush/waku_lightpush.go @@ -5,6 +5,7 @@ import ( "encoding/hex" "errors" "fmt" + "math" logging "github.com/ipfs/go-log" "github.com/libp2p/go-libp2p-core/host" @@ -62,7 +63,7 @@ func (wakuLP *WakuLightPush) onRequest(s network.Stream) { requestPushRPC := &pb.PushRPC{} writer := protoio.NewDelimitedWriter(s) - reader := protoio.NewDelimitedReader(s, 64*1024) + reader := protoio.NewDelimitedReader(s, math.MaxInt64) err := reader.ReadMsg(requestPushRPC) if err != nil { @@ -158,7 +159,7 @@ func (wakuLP *WakuLightPush) request(ctx context.Context, req *pb.PushRequest, o pushRequestRPC := &pb.PushRPC{RequestId: hex.EncodeToString(params.requestId), Query: req} writer := protoio.NewDelimitedWriter(connOpt) - reader := protoio.NewDelimitedReader(connOpt, 64*1024) + reader := protoio.NewDelimitedReader(connOpt, math.MaxInt64) err = writer.WriteMsg(pushRequestRPC) if err != nil { diff --git a/waku/v2/protocol/store/waku_store.go b/waku/v2/protocol/store/waku_store.go index 546f3172..9e6d15a9 100644 --- a/waku/v2/protocol/store/waku_store.go +++ b/waku/v2/protocol/store/waku_store.go @@ -343,7 +343,7 @@ func (store *WakuStore) onRequest(s network.Stream) { historyRPCRequest := &pb.HistoryRPC{} writer := protoio.NewDelimitedWriter(s) - reader := protoio.NewDelimitedReader(s, 64*1024) + reader := protoio.NewDelimitedReader(s, math.MaxInt64) err := reader.ReadMsg(historyRPCRequest) if err != nil { @@ -510,7 +510,7 @@ func (store *WakuStore) queryFrom(ctx context.Context, q *pb.HistoryQuery, selec historyRequest := &pb.HistoryRPC{Query: q, RequestId: hex.EncodeToString(requestId)} writer := protoio.NewDelimitedWriter(connOpt) - reader := protoio.NewDelimitedReader(connOpt, 64*1024) + reader := protoio.NewDelimitedReader(connOpt, math.MaxInt64) err = writer.WriteMsg(historyRequest) if err != nil {