Skip to content

Commit

Permalink
chore: fix EOF
Browse files Browse the repository at this point in the history
Signed-off-by: charankamarapu <kamarapucharan@gmail.com>
  • Loading branch information
charankamarapu committed Mar 26, 2024
1 parent 8a78789 commit e457191
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 1 deletion.
4 changes: 4 additions & 0 deletions pkg/core/proxy/integrations/generic/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package generic

import (
"context"
"io"
"net"
"time"

Expand Down Expand Up @@ -111,6 +112,9 @@ func decodeGeneric(ctx context.Context, logger *zap.Logger, reqBuf []byte, clien
case <-ctx.Done():
return ctx.Err()
case err := <-errCh:
if err == io.EOF {
return nil
}
return err
}
}
7 changes: 6 additions & 1 deletion pkg/core/proxy/integrations/generic/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import (
"context"
"encoding/base64"
"errors"
"golang.org/x/sync/errgroup"
"io"
"net"
"strconv"
"time"

"golang.org/x/sync/errgroup"

"go.keploy.io/server/v2/pkg/core/proxy/integrations/util"
pUtil "go.keploy.io/server/v2/pkg/core/proxy/util"
"go.keploy.io/server/v2/pkg/models"
Expand Down Expand Up @@ -203,6 +205,9 @@ func encodeGeneric(ctx context.Context, logger *zap.Logger, reqBuf []byte, clien
logger.Debug("the iteration for the generic response ends with no of genericReqs:" + strconv.Itoa(len(genericRequests)) + " and genericResps: " + strconv.Itoa(len(genericResponses)))
prevChunkWasReq = false
case err := <-errChan:
if err == io.EOF {
return nil
}
return err
}
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/core/proxy/integrations/mongo/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,9 @@ func encodeMongo(ctx context.Context, logger *zap.Logger, reqBuf []byte, clientC
case <-ctx.Done():
return ctx.Err()
case err := <-errCh:
if err == io.EOF {
return nil
}
return err
}
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/core/proxy/integrations/postgres/v1/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ func decodePostgres(ctx context.Context, logger *zap.Logger, reqBuf []byte, clie
case <-ctx.Done():
return ctx.Err()
case err := <-errCh:
if err == io.EOF {
return nil
}
return err
}
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/core/proxy/integrations/postgres/v1/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package v1
import (
"context"
"encoding/binary"
"io"
"net"
"strconv"
"time"
Expand Down Expand Up @@ -387,6 +388,9 @@ func encodePostgres(ctx context.Context, logger *zap.Logger, reqBuf []byte, clie
logger.Debug("the iteration for the postgres response ends with no of postgresReqs:" + strconv.Itoa(len(pgRequests)) + " and pgResps: " + strconv.Itoa(len(pgResponses)))
prevChunkWasReq = false
case err := <-errChan:
if err == io.EOF {
return nil
}
return err
}
}
Expand Down

0 comments on commit e457191

Please sign in to comment.