Method
_set_linger
(conn: psycopg.Connection)
Source from the content-addressed store, hash-verified
| 174 | |
| 175 | @staticmethod |
| 176 | def _set_linger(conn: psycopg.Connection) -> None: |
| 177 | import socket |
| 178 | import struct |
| 179 | |
| 180 | fd = conn.pgconn.socket |
| 181 | if fd < 0: |
| 182 | return |
| 183 | sock = socket.socket(fileno=fd) |
| 184 | try: |
| 185 | sock.setsockopt( |
| 186 | socket.SOL_SOCKET, socket.SO_LINGER, struct.pack("ii", 1, 0) |
| 187 | ) |
| 188 | finally: |
| 189 | sock.detach() |
| 190 | |
| 191 | def to_conn_string(self) -> str: |
| 192 | return ( |
Tested by
no test coverage detected