libpq_keepalive.diff

text/x-diff

Filename: libpq_keepalive.diff
Type: text/x-diff
Part: 0
Message: TCP keepalive support for libpq

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: context
File+
src/interfaces/libpq/fe-connect.c 12 0
*** a/src/interfaces/libpq/fe-connect.c
--- b/src/interfaces/libpq/fe-connect.c
***************
*** 1321,1326 **** keep_going:						/* We will come back to here until there is
--- 1321,1338 ----
  						continue;
  					}
  #endif   /* F_SETFD */
+ 					optval = 1;
+ 					if (setsockopt(conn->sock, SOL_SOCKET, SO_KEEPALIVE,
+ 						       (char *) &optval, sizeof(optval)) == -1)
+ 					{
+ 						appendPQExpBuffer(&conn->errorMessage,
+ 										  libpq_gettext("could not set keepalive on socket: %s\n"),
+ 							SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf)));
+ 						closesocket(conn->sock);
+ 						conn->sock = -1;
+ 						conn->addr_cur = addr_cur->ai_next;
+ 						continue;
+ 					}
  
  					/*----------
  					 * We have three methods of blocking SIGPIPE during