mirror of https://github.com/MISP/PyMISP
parent
a10788c7e5
commit
56a70265a0
|
@ -28,6 +28,17 @@ from .mispevent import MISPEvent, MISPAttribute, MISPSighting, MISPLog, MISPObje
|
||||||
MISPGalaxyCluster, MISPGalaxyClusterRelation, MISPCorrelationExclusion
|
MISPGalaxyCluster, MISPGalaxyClusterRelation, MISPCorrelationExclusion
|
||||||
from .abstract import pymisp_json_default, MISPTag, AbstractMISP, describe_types
|
from .abstract import pymisp_json_default, MISPTag, AbstractMISP, describe_types
|
||||||
|
|
||||||
|
|
||||||
|
# Enable TCP keepalive by default on every requests
|
||||||
|
import socket
|
||||||
|
from urllib3.connection import HTTPConnection
|
||||||
|
HTTPConnection.default_socket_options = HTTPConnection.default_socket_options + [
|
||||||
|
(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1), # enable keepalive
|
||||||
|
(socket.SOL_TCP, socket.TCP_KEEPIDLE, 30), # Start pinging after 30s of idle time
|
||||||
|
(socket.SOL_TCP, socket.TCP_KEEPINTVL, 10), # ping every 10s
|
||||||
|
(socket.SOL_TCP, socket.TCP_KEEPCNT, 6) # kill the connection if 6 ping fail (60s total)
|
||||||
|
]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# cached_property exists since Python 3.8
|
# cached_property exists since Python 3.8
|
||||||
from functools import cached_property # type: ignore
|
from functools import cached_property # type: ignore
|
||||||
|
|
Loading…
Reference in New Issue