diff --git a/conn.go b/conn.go index 7df49a46..99858ba6 100644 --- a/conn.go +++ b/conn.go @@ -708,22 +708,6 @@ func (c *Conn) processContextFreeMsg(msg pgproto3.BackendMessage) (err error) { return nil } -func (c *Conn) rxMsg() (pgproto3.BackendMessage, error) { - if !c.IsAlive() { - return nil, ErrDeadConn - } - - msg, err := c.pgConn.ReceiveMessage() - if err != nil { - if netErr, ok := err.(net.Error); !(ok && netErr.Timeout()) { - c.die(err) - } - return nil, err - } - - return msg, nil -} - func (c *Conn) rxErrorResponse(msg *pgproto3.ErrorResponse) *pgconn.PgError { err := &pgconn.PgError{ Severity: msg.Severity, @@ -975,7 +959,7 @@ func (c *Conn) waitForPreviousCancelQuery(ctx context.Context) error { func (c *Conn) ensureConnectionReadyForQuery() error { for c.pendingReadyForQueryCount > 0 { - msg, err := c.rxMsg() + msg, err := c.pgConn.ReceiveMessage() if err != nil { return err } diff --git a/fastpath.go b/fastpath.go index f9764c53..bee0dd0a 100644 --- a/fastpath.go +++ b/fastpath.go @@ -79,7 +79,7 @@ func (f *fastpath) Call(oid pgtype.OID, args []fpArg) (res []byte, err error) { f.cn.pendingReadyForQueryCount++ for { - msg, err := f.cn.rxMsg() + msg, err := f.cn.pgConn.ReceiveMessage() if err != nil { return nil, err } diff --git a/replication.go b/replication.go index 98ca9aab..ad812947 100644 --- a/replication.go +++ b/replication.go @@ -219,7 +219,7 @@ func (rc *ReplicationConn) GetConnInfo() *pgtype.ConnInfo { } func (rc *ReplicationConn) readReplicationMessage() (r *ReplicationMessage, err error) { - msg, err := rc.c.rxMsg() + msg, err := rc.c.pgConn.ReceiveMessage() if err != nil { return } @@ -344,7 +344,7 @@ func (rc *ReplicationConn) sendReplicationModeQuery(sql string) (*Rows, error) { rows.fatal(err) } - msg, err := rc.c.rxMsg() + msg, err := rc.c.pgConn.ReceiveMessage() if err != nil { return nil, err }