Go to the source code of this file.
◆ ClientConnectionInfo
◆ ClientSocket
◆ Port
◆ pq_getkeepalivescount()
int pq_getkeepalivescount |
( |
Port * |
port | ) |
|
Definition at line 1799 of file pqcomm.c.
1800{
1801#ifdef TCP_KEEPCNT
1802 if (
port == NULL ||
port->laddr.addr.ss_family == AF_UNIX)
1803 return 0;
1804
1805 if (
port->keepalives_count != 0)
1806 return port->keepalives_count;
1807
1808 if (
port->default_keepalives_count == 0)
1809 {
1811
1812 if (getsockopt(
port->sock, IPPROTO_TCP, TCP_KEEPCNT,
1813 (
char *) &
port->default_keepalives_count,
1815 {
1817 (
errmsg(
"%s(%s) failed: %m",
"getsockopt",
"TCP_KEEPCNT")));
1818 port->default_keepalives_count = -1;
1819 }
1820 }
1821
1822 return port->default_keepalives_count;
1823#else
1824 return 0;
1825#endif
1826}
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
static pg_noinline void Size size
References ereport, errmsg(), LOG, port, and size.
Referenced by pq_setkeepalivescount(), and show_tcp_keepalives_count().
◆ pq_getkeepalivesidle()
int pq_getkeepalivesidle |
( |
Port * |
port | ) |
|
Definition at line 1630 of file pqcomm.c.
1631{
1632#if defined(PG_TCP_KEEPALIVE_IDLE) || defined(SIO_KEEPALIVE_VALS)
1633 if (
port == NULL ||
port->laddr.addr.ss_family == AF_UNIX)
1634 return 0;
1635
1636 if (
port->keepalives_idle != 0)
1637 return port->keepalives_idle;
1638
1639 if (
port->default_keepalives_idle == 0)
1640 {
1641#ifndef WIN32
1643
1644 if (getsockopt(
port->sock, IPPROTO_TCP, PG_TCP_KEEPALIVE_IDLE,
1645 (
char *) &
port->default_keepalives_idle,
1647 {
1649 (
errmsg(
"%s(%s) failed: %m",
"getsockopt", PG_TCP_KEEPALIVE_IDLE_STR)));
1650 port->default_keepalives_idle = -1;
1651 }
1652#else
1653
1654 port->default_keepalives_idle = -1;
1655#endif
1656 }
1657
1658 return port->default_keepalives_idle;
1659#else
1660 return 0;
1661#endif
1662}
References ereport, errmsg(), LOG, port, and size.
Referenced by pq_setkeepalivesidle(), and show_tcp_keepalives_idle().
◆ pq_getkeepalivesinterval()
int pq_getkeepalivesinterval |
( |
Port * |
port | ) |
|
Definition at line 1715 of file pqcomm.c.
1716{
1717#if defined(TCP_KEEPINTVL) || defined(SIO_KEEPALIVE_VALS)
1718 if (
port == NULL ||
port->laddr.addr.ss_family == AF_UNIX)
1719 return 0;
1720
1721 if (
port->keepalives_interval != 0)
1722 return port->keepalives_interval;
1723
1724 if (
port->default_keepalives_interval == 0)
1725 {
1726#ifndef WIN32
1728
1729 if (getsockopt(
port->sock, IPPROTO_TCP, TCP_KEEPINTVL,
1730 (
char *) &
port->default_keepalives_interval,
1732 {
1734 (
errmsg(
"%s(%s) failed: %m",
"getsockopt",
"TCP_KEEPINTVL")));
1735 port->default_keepalives_interval = -1;
1736 }
1737#else
1738
1739 port->default_keepalives_interval = -1;
1740#endif
1741 }
1742
1743 return port->default_keepalives_interval;
1744#else
1745 return 0;
1746#endif
1747}
References ereport, errmsg(), LOG, port, and size.
Referenced by pq_setkeepalivesinterval(), and show_tcp_keepalives_interval().
◆ pq_gettcpusertimeout()
int pq_gettcpusertimeout |
( |
Port * |
port | ) |
|
Definition at line 1874 of file pqcomm.c.
1875{
1876#ifdef TCP_USER_TIMEOUT
1877 if (
port == NULL ||
port->laddr.addr.ss_family == AF_UNIX)
1878 return 0;
1879
1880 if (
port->tcp_user_timeout != 0)
1881 return port->tcp_user_timeout;
1882
1883 if (
port->default_tcp_user_timeout == 0)
1884 {
1886
1887 if (getsockopt(
port->sock, IPPROTO_TCP, TCP_USER_TIMEOUT,
1888 (
char *) &
port->default_tcp_user_timeout,
1890 {
1892 (
errmsg(
"%s(%s) failed: %m",
"getsockopt",
"TCP_USER_TIMEOUT")));
1893 port->default_tcp_user_timeout = -1;
1894 }
1895 }
1896
1897 return port->default_tcp_user_timeout;
1898#else
1899 return 0;
1900#endif
1901}
References ereport, errmsg(), LOG, port, and size.
Referenced by pq_settcpusertimeout(), and show_tcp_user_timeout().
◆ pq_setkeepalivescount()
int pq_setkeepalivescount |
( |
int |
count, |
|
|
Port * |
port |
|
) |
| |
Definition at line 1829 of file pqcomm.c.
1830{
1831 if (
port == NULL ||
port->laddr.addr.ss_family == AF_UNIX)
1833
1834#ifdef TCP_KEEPCNT
1835 if (count ==
port->keepalives_count)
1837
1838 if (
port->default_keepalives_count <= 0)
1839 {
1841 {
1842 if (count == 0)
1844 else
1846 }
1847 }
1848
1849 if (count == 0)
1850 count =
port->default_keepalives_count;
1851
1852 if (setsockopt(
port->sock, IPPROTO_TCP, TCP_KEEPCNT,
1853 (char *) &count, sizeof(count)) < 0)
1854 {
1856 (
errmsg(
"%s(%s) failed: %m",
"setsockopt",
"TCP_KEEPCNT")));
1858 }
1859
1860 port->keepalives_count = count;
1861#else
1862 if (count != 0)
1863 {
1865 (
errmsg(
"%s(%s) not supported",
"setsockopt",
"TCP_KEEPCNT")));
1867 }
1868#endif
1869
1871}
int pq_getkeepalivescount(Port *port)
References ereport, errmsg(), LOG, port, pq_getkeepalivescount(), STATUS_ERROR, and STATUS_OK.
Referenced by assign_tcp_keepalives_count(), and pq_init().
◆ pq_setkeepalivesidle()
int pq_setkeepalivesidle |
( |
int |
idle, |
|
|
Port * |
port |
|
) |
| |
Definition at line 1665 of file pqcomm.c.
1666{
1667 if (
port == NULL ||
port->laddr.addr.ss_family == AF_UNIX)
1669
1670
1671#if defined(PG_TCP_KEEPALIVE_IDLE) || defined(SIO_KEEPALIVE_VALS)
1672 if (idle ==
port->keepalives_idle)
1674
1675#ifndef WIN32
1676 if (
port->default_keepalives_idle <= 0)
1677 {
1679 {
1680 if (idle == 0)
1682 else
1684 }
1685 }
1686
1687 if (idle == 0)
1688 idle =
port->default_keepalives_idle;
1689
1690 if (setsockopt(
port->sock, IPPROTO_TCP, PG_TCP_KEEPALIVE_IDLE,
1691 (char *) &idle, sizeof(idle)) < 0)
1692 {
1694 (
errmsg(
"%s(%s) failed: %m",
"setsockopt", PG_TCP_KEEPALIVE_IDLE_STR)));
1696 }
1697
1698 port->keepalives_idle = idle;
1699#else
1700 return pq_setkeepaliveswin32(
port, idle,
port->keepalives_interval);
1701#endif
1702#else
1703 if (idle != 0)
1704 {
1706 (
errmsg(
"setting the keepalive idle time is not supported")));
1708 }
1709#endif
1710
1712}
int pq_getkeepalivesidle(Port *port)
References ereport, errmsg(), LOG, port, pq_getkeepalivesidle(), STATUS_ERROR, and STATUS_OK.
Referenced by assign_tcp_keepalives_idle(), and pq_init().
◆ pq_setkeepalivesinterval()
int pq_setkeepalivesinterval |
( |
int |
interval, |
|
|
Port * |
port |
|
) |
| |
Definition at line 1750 of file pqcomm.c.
1751{
1752 if (
port == NULL ||
port->laddr.addr.ss_family == AF_UNIX)
1754
1755#if defined(TCP_KEEPINTVL) || defined(SIO_KEEPALIVE_VALS)
1758
1759#ifndef WIN32
1760 if (
port->default_keepalives_interval <= 0)
1761 {
1763 {
1766 else
1768 }
1769 }
1770
1773
1774 if (setsockopt(
port->sock, IPPROTO_TCP, TCP_KEEPINTVL,
1776 {
1778 (
errmsg(
"%s(%s) failed: %m",
"setsockopt",
"TCP_KEEPINTVL")));
1780 }
1781
1783#else
1785#endif
1786#else
1788 {
1790 (
errmsg(
"%s(%s) not supported",
"setsockopt",
"TCP_KEEPINTVL")));
1792 }
1793#endif
1794
1796}
int pq_getkeepalivesinterval(Port *port)
References ereport, errmsg(), LOG, port, pq_getkeepalivesinterval(), STATUS_ERROR, and STATUS_OK.
Referenced by assign_tcp_keepalives_interval(), and pq_init().
◆ pq_settcpusertimeout()
int pq_settcpusertimeout |
( |
int |
timeout, |
|
|
Port * |
port |
|
) |
| |
Definition at line 1904 of file pqcomm.c.
1905{
1906 if (
port == NULL ||
port->laddr.addr.ss_family == AF_UNIX)
1908
1909#ifdef TCP_USER_TIMEOUT
1910 if (timeout ==
port->tcp_user_timeout)
1912
1913 if (
port->default_tcp_user_timeout <= 0)
1914 {
1916 {
1917 if (timeout == 0)
1919 else
1921 }
1922 }
1923
1924 if (timeout == 0)
1925 timeout =
port->default_tcp_user_timeout;
1926
1927 if (setsockopt(
port->sock, IPPROTO_TCP, TCP_USER_TIMEOUT,
1928 (char *) &timeout, sizeof(timeout)) < 0)
1929 {
1931 (
errmsg(
"%s(%s) failed: %m",
"setsockopt",
"TCP_USER_TIMEOUT")));
1933 }
1934
1935 port->tcp_user_timeout = timeout;
1936#else
1937 if (timeout != 0)
1938 {
1940 (
errmsg(
"%s(%s) not supported",
"setsockopt",
"TCP_USER_TIMEOUT")));
1942 }
1943#endif
1944
1946}
int pq_gettcpusertimeout(Port *port)
References ereport, errmsg(), LOG, port, pq_gettcpusertimeout(), STATUS_ERROR, and STATUS_OK.
Referenced by assign_tcp_user_timeout(), and pq_init().
◆ FrontendProtocol
◆ MyClientConnectionInfo