mirror of
https://github.com/postgres/postgres.git
synced 2025-06-27 23:21:58 +03:00
Adjust libpq to avoid deadlock when both client and server want to send
data, and both have filled the transmission buffers. One scenario where this can happen was illustrated here: http://archives.postgresql.org/pgsql-hackers/2003-04/msg00979.php
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.151 2003/10/04 21:05:21 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.152 2003/10/19 21:36:41 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1336,6 +1336,17 @@ PQputCopyData(PGconn *conn, const char *buffer, int nbytes)
|
||||
libpq_gettext("no COPY in progress\n"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for NOTICE messages coming back from the server. Since the
|
||||
* server might generate multiple notices during the COPY, we have to
|
||||
* consume those in a reasonably prompt fashion to prevent the comm
|
||||
* buffers from filling up and possibly blocking the server.
|
||||
*/
|
||||
if (!PQconsumeInput(conn))
|
||||
return -1; /* I/O failure */
|
||||
parseInput(conn);
|
||||
|
||||
if (nbytes > 0)
|
||||
{
|
||||
/*
|
||||
|
Reference in New Issue
Block a user