Set socket to non-blocking mode in Read, Flush and BufferReadUntilBlock operations
This commit is contained in:
committed by
Jack Christensen
parent
3db7d1774e
commit
b2b4fbcf57
@@ -4,7 +4,6 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/jackc/pgx/v5/internal/nbconn"
|
||||
"io"
|
||||
|
||||
"github.com/jackc/pgx/v5/internal/pgio"
|
||||
@@ -132,17 +131,6 @@ func (ct *copyFrom) run(ctx context.Context) (int64, error) {
|
||||
return 0, fmt.Errorf("unknown QueryExecMode: %v", ct.mode)
|
||||
}
|
||||
|
||||
if realNbConn, ok := ct.conn.pgConn.Conn().(*nbconn.NetConn); ok {
|
||||
if err := realNbConn.SetBlockingMode(false); err != nil {
|
||||
return 0, fmt.Errorf("cannot set socket non-blocking mode: %w", err)
|
||||
}
|
||||
|
||||
defer func() {
|
||||
// TODO: Deal with it
|
||||
_ = realNbConn.SetBlockingMode(true)
|
||||
}()
|
||||
}
|
||||
|
||||
r, w := io.Pipe()
|
||||
doneChan := make(chan struct{})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user