Skip to content

Commit

Permalink
Try terminating connections earlier.
Browse files Browse the repository at this point in the history
  • Loading branch information
tecarter94 committed Dec 10, 2024
1 parent 7865e50 commit e9ee470
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/domainproxy/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ func (c *Common) NewSharedParams() SharedParams {

func (c *Common) BiDirectionalTransfer(runningContext context.Context, leftConnection, rightConnection net.Conn, byteBufferSize int, idleTimeout time.Duration, connectionType string, connectionNo uint64) {
defer c.CloseConnection(leftConnection, rightConnection, connectionType, connectionNo)
transferContext, terminateTransfer := context.WithCancel(runningContext)
if err := leftConnection.SetDeadline(time.Now().Add(idleTimeout)); err != nil {
c.HandleSetDeadlineError(leftConnection, err)
return
Expand All @@ -66,6 +65,7 @@ func (c *Common) BiDirectionalTransfer(runningContext context.Context, leftConne
c.HandleSetDeadlineError(rightConnection, err)
return
}

Check warning on line 67 in pkg/domainproxy/common/common.go

View check run for this annotation

Codecov / codecov/patch

pkg/domainproxy/common/common.go#L65-L67

Added lines #L65 - L67 were not covered by tests
transferContext, terminateTransfer := context.WithCancel(runningContext)
go c.Transfer(transferContext, terminateTransfer, leftConnection, rightConnection, byteBufferSize, idleTimeout, connectionType, connectionNo)
go c.Transfer(transferContext, terminateTransfer, rightConnection, leftConnection, byteBufferSize, idleTimeout, connectionType, connectionNo)
<-transferContext.Done()
Expand Down

0 comments on commit e9ee470

Please sign in to comment.