def __init__(self, server, endpoint, heartbeat_interval=1, timeout=3, idle_timeout=10, unresponsive_disconnect=30, idle_disconnect=60):
        assert heartbeat_interval < timeout < idle_timeout
        self.server = server
        self.endpoint = endpoint
        self.timeout = timeout
        self.heartbeat_interval = heartbeat_interval
        self.idle_timeout = idle_timeout
        self.unresponsive_disconnect = unresponsive_disconnect
        self.idle_disconnect = idle_disconnect

        now = time.monotonic()
        self.last_seen = 0
        self.idle_since = 0
        self.last_message = now
        self.created_at = now
        self.heartbeat_samples = SampleWindow(100, factor=1000)  # milliseconds
        self.explicit_heartbeat_count = 0
        self.status = UNKNOWN

        self.received_message_count = 0
        self.sent_message_count = 0

        if self.heartbeat_interval:
            self.heartbeat_loop_greenlet = self.server.spawn(self.heartbeat_loop)
            self.live_check_loop_greenlet = self.server.spawn(self.live_check_loop)
        else:
            self.heartbeat_loop_greenlet = None
            self.live_check_loop_greenlet = None

        self.pid = os.getpid()
dataset/ETHPy150Open deliveryhero/lymph/lymph/core/connection.py/Connection.__init__/original