Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 4dec98c

Browse files
committed
libpq: Move pg_cancel to fe-cancel.c
No other files need to access this struct, so there is no need to have its definition in a header file. Author: Jelte Fennema-Nio <postgres@jeltef.nl> Discussion: https://postgr.es/m/202403061822.spfzqbf7dsgg@alvherre.pgsql
1 parent d6e171f commit 4dec98c

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

src/interfaces/libpq/fe-cancel.c

+20
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,26 @@
2121
#include "libpq-int.h"
2222
#include "port/pg_bswap.h"
2323

24+
25+
/*
26+
* pg_cancel (backing struct for PGcancel) stores all data necessary to send a
27+
* cancel request.
28+
*/
29+
struct pg_cancel
30+
{
31+
SockAddr raddr; /* Remote address */
32+
int be_pid; /* PID of to-be-canceled backend */
33+
int be_key; /* cancel key of to-be-canceled backend */
34+
int pgtcp_user_timeout; /* tcp user timeout */
35+
int keepalives; /* use TCP keepalives? */
36+
int keepalives_idle; /* time between TCP keepalives */
37+
int keepalives_interval; /* time between TCP keepalive
38+
* retransmits */
39+
int keepalives_count; /* maximum number of TCP keepalive
40+
* retransmits */
41+
};
42+
43+
2444
/*
2545
* PQgetCancel: get a PGcancel structure corresponding to a connection.
2646
*

src/interfaces/libpq/libpq-int.h

-18
Original file line numberDiff line numberDiff line change
@@ -621,24 +621,6 @@ struct pg_conn
621621
PQExpBufferData workBuffer; /* expansible string */
622622
};
623623

624-
/* PGcancel stores all data necessary to cancel a connection. A copy of this
625-
* data is required to safely cancel a connection running on a different
626-
* thread.
627-
*/
628-
struct pg_cancel
629-
{
630-
SockAddr raddr; /* Remote address */
631-
int be_pid; /* PID of backend --- needed for cancels */
632-
int be_key; /* key of backend --- needed for cancels */
633-
int pgtcp_user_timeout; /* tcp user timeout */
634-
int keepalives; /* use TCP keepalives? */
635-
int keepalives_idle; /* time between TCP keepalives */
636-
int keepalives_interval; /* time between TCP keepalive
637-
* retransmits */
638-
int keepalives_count; /* maximum number of TCP keepalive
639-
* retransmits */
640-
};
641-
642624

643625
/* String descriptions of the ExecStatusTypes.
644626
* direct use of this array is deprecated; call PQresStatus() instead.

0 commit comments

Comments
 (0)