- Notifications
You must be signed in to change notification settings - Fork4.9k
Commitbb42ad1
committed
Ensure we discard unread/unsent data when abandoning a connection attempt.
There are assorted situations wherein PQconnectPoll() will abandon aconnection attempt and try again with different parameters (eg, SSL versusnot SSL). However, the code forgot to discard any pending data in libpq'sI/O buffers when doing this. In at least one case (server returns Emessage during SSL negotiation), there is unread input data which bollixesthe next connection attempt. I have not checked to see whether this ispossible in the other cases where we close the socket and retry, but itseems like a matter of good defensive programming to add explicitbuffer-flushing code to all of them.This is one of several issues exposed by Daniel Farina's report ofmisbehavior after a server-side fork failure.This has been wrong since forever, so back-patch to all supported branches.1 parentae42744 commitbb42ad1
1 file changed
+15
-0
lines changedLines changed: 15 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1379 | 1379 |
| |
1380 | 1380 |
| |
1381 | 1381 |
| |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
1382 | 1385 |
| |
1383 | 1386 |
| |
1384 | 1387 |
| |
| |||
1416 | 1419 |
| |
1417 | 1420 |
| |
1418 | 1421 |
| |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
1419 | 1425 |
| |
1420 | 1426 |
| |
1421 | 1427 |
| |
| |||
1528 | 1534 |
| |
1529 | 1535 |
| |
1530 | 1536 |
| |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
1531 | 1540 |
| |
1532 | 1541 |
| |
1533 | 1542 |
| |
| |||
1594 | 1603 |
| |
1595 | 1604 |
| |
1596 | 1605 |
| |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
1597 | 1609 |
| |
1598 | 1610 |
| |
1599 | 1611 |
| |
| |||
1613 | 1625 |
| |
1614 | 1626 |
| |
1615 | 1627 |
| |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
1616 | 1631 |
| |
1617 | 1632 |
| |
1618 | 1633 |
| |
|
0 commit comments
Comments
(0)