Browse Source

Make DHT ignore SIGINT (#493)

* make DHT ignore SIGINT
* update p2pd version

Co-authored-by: @borzunov
(cherry picked from commit 61e5e8c1f33dd2390e6d0d0221e2de6e75741a9c)
Dmitry Baranchuk 3 years ago
parent
commit
752f5ea91e
2 changed files with 6 additions and 2 deletions
  1. 4 0
      hivemind/dht/dht.py
  2. 2 2
      setup.py

+ 4 - 0
hivemind/dht/dht.py

@@ -3,6 +3,7 @@ from __future__ import annotations
 import asyncio
 import asyncio
 import multiprocessing as mp
 import multiprocessing as mp
 import os
 import os
+import signal
 from functools import partial
 from functools import partial
 from typing import Awaitable, Callable, Iterable, List, Optional, Sequence, TypeVar, Union
 from typing import Awaitable, Callable, Iterable, List, Optional, Sequence, TypeVar, Union
 
 
@@ -94,6 +95,9 @@ class DHT(mp.Process):
         loop.add_reader(self._inner_pipe.fileno(), pipe_semaphore.release)
         loop.add_reader(self._inner_pipe.fileno(), pipe_semaphore.release)
 
 
         async def _run():
         async def _run():
+            # Set SIG_IGN handler to SIGINT
+            signal.signal(signal.SIGINT, signal.SIG_IGN)
+
             try:
             try:
                 if self._daemon_listen_maddr is not None:
                 if self._daemon_listen_maddr is not None:
                     replicated_p2p = await P2P.replicate(self._daemon_listen_maddr)
                     replicated_p2p = await P2P.replicate(self._daemon_listen_maddr)

+ 2 - 2
setup.py

@@ -13,14 +13,14 @@ from setuptools import find_packages, setup
 from setuptools.command.build_py import build_py
 from setuptools.command.build_py import build_py
 from setuptools.command.develop import develop
 from setuptools.command.develop import develop
 
 
-P2PD_VERSION = "v0.3.9"
+P2PD_VERSION = "v0.3.10"
 
 
 P2PD_SOURCE_URL = f"https://github.com/learning-at-home/go-libp2p-daemon/archive/refs/tags/{P2PD_VERSION}.tar.gz"
 P2PD_SOURCE_URL = f"https://github.com/learning-at-home/go-libp2p-daemon/archive/refs/tags/{P2PD_VERSION}.tar.gz"
 P2PD_BINARY_URL = f"https://github.com/learning-at-home/go-libp2p-daemon/releases/download/{P2PD_VERSION}/"
 P2PD_BINARY_URL = f"https://github.com/learning-at-home/go-libp2p-daemon/releases/download/{P2PD_VERSION}/"
 
 
 # The value is sha256 of the binary from the release page
 # The value is sha256 of the binary from the release page
 EXECUTABLES = {
 EXECUTABLES = {
-    "p2pd": "8f9434f4717f6e851430f75f07e283d5ddeb2c7cde1b3648e677d813703f4e40",
+    "p2pd": "a9728685fd020dd5f0292e64b82740ac1643bbe9f793ec6d0b765c7efc28bcec",
 }
 }