libpq: Move pg_cancel to fe-cancel.c
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Tue, 12 Mar 2024 08:11:24 +0000 (09:11 +0100)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Tue, 12 Mar 2024 08:11:24 +0000 (09:11 +0100)
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

src/interfaces/libpq/fe-cancel.c
src/interfaces/libpq/libpq-int.h

index 51f8d8a78c4066760f28296d8e1700b404e1e203..d69b8f9f9f4fee2dbf8ba49af11f351d6d663e33 100644 (file)
 #include "libpq-int.h"
 #include "port/pg_bswap.h"
 
+
+/*
+ * pg_cancel (backing struct for PGcancel) stores all data necessary to send a
+ * cancel request.
+ */
+struct pg_cancel
+{
+   SockAddr    raddr;          /* Remote address */
+   int         be_pid;         /* PID of to-be-canceled backend */
+   int         be_key;         /* cancel key of to-be-canceled backend */
+   int         pgtcp_user_timeout; /* tcp user timeout */
+   int         keepalives;     /* use TCP keepalives? */
+   int         keepalives_idle;    /* time between TCP keepalives */
+   int         keepalives_interval;    /* time between TCP keepalive
+                                        * retransmits */
+   int         keepalives_count;   /* maximum number of TCP keepalive
+                                    * retransmits */
+};
+
+
 /*
  * PQgetCancel: get a PGcancel structure corresponding to a connection.
  *
index 82c18f870d2adfd341e72950fe12f5d79574661d..3abcd180d6ddbe55c068263d8cd04db4ed6a55a8 100644 (file)
@@ -621,24 +621,6 @@ struct pg_conn
    PQExpBufferData workBuffer; /* expansible string */
 };
 
-/* PGcancel stores all data necessary to cancel a connection. A copy of this
- * data is required to safely cancel a connection running on a different
- * thread.
- */
-struct pg_cancel
-{
-   SockAddr    raddr;          /* Remote address */
-   int         be_pid;         /* PID of backend --- needed for cancels */
-   int         be_key;         /* key of backend --- needed for cancels */
-   int         pgtcp_user_timeout; /* tcp user timeout */
-   int         keepalives;     /* use TCP keepalives? */
-   int         keepalives_idle;    /* time between TCP keepalives */
-   int         keepalives_interval;    /* time between TCP keepalive
-                                        * retransmits */
-   int         keepalives_count;   /* maximum number of TCP keepalive
-                                    * retransmits */
-};
-
 
 /* String descriptions of the ExecStatusTypes.
  * direct use of this array is deprecated; call PQresStatus() instead.