From ed7b3e8cffd62462ea79c523c5eda2d0f527dc1c Mon Sep 17 00:00:00 2001 From: Termina1 Date: Thu, 12 Sep 2024 21:25:16 +0300 Subject: [PATCH] closing feed when drain already closed --- sync.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sync.go b/sync.go index 0abff54..6fdb2e1 100644 --- a/sync.go +++ b/sync.go @@ -175,6 +175,10 @@ func (sync *Syncer) GetDrainState() SyncState { } func (sync *Syncer) Feed(ctx context.Context) (recs protocol.Records, err error) { + // other side closed the connection already + if sync.GetDrainState() == SendNone { + sync.SetFeedState(ctx, SendNone) + } switch sync.GetFeedState() { case SendHandshake: recs, err = sync.FeedHandshake()