| 570 | } |
| 571 | |
| 572 | func (pgConn *PgConn) signalMessage() chan struct{} { |
| 573 | if pgConn.bufferingReceive { |
| 574 | panic("BUG: signalMessage when already in progress") |
| 575 | } |
| 576 | |
| 577 | pgConn.bufferingReceive = true |
| 578 | pgConn.bufferingReceiveMux.Lock() |
| 579 | |
| 580 | ch := make(chan struct{}) |
| 581 | go func() { |
| 582 | pgConn.bufferingReceiveMsg, pgConn.bufferingReceiveErr = pgConn.frontend.Receive() |
| 583 | pgConn.bufferingReceiveMux.Unlock() |
| 584 | close(ch) |
| 585 | }() |
| 586 | |
| 587 | return ch |
| 588 | } |
| 589 | |
| 590 | // ReceiveMessage receives one wire protocol message from the PostgreSQL server. It must only be used when the |
| 591 | // connection is not busy. e.g. It is an error to call [PgConn.ReceiveMessage] while reading the result of a query. The messages |