From 6955da4bb219cd70a6703b6607850e977b684900 Mon Sep 17 00:00:00 2001 From: Leon Morten Richter Date: Mon, 19 Aug 2024 16:41:07 +0200 Subject: [PATCH] fix: partially revert #148 (compat) --- CHANGELOG.txt | 4 ++++ pyais/__init__.py | 2 +- pyais/stream.py | 6 ++---- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 2e59a6e..fe8af9e 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,6 +1,10 @@ ==================== pyais CHANGELOG ==================== +------------------------------------------------------------------------------- + Version 2.7.2 19 Aug 2024 +------------------------------------------------------------------------------- +* removes `reuse` for TCP/UDP sockets ------------------------------------------------------------------------------- Version 2.7.1 17 Aug 2024 ------------------------------------------------------------------------------- diff --git a/pyais/__init__.py b/pyais/__init__.py index f2e258f..800acb1 100644 --- a/pyais/__init__.py +++ b/pyais/__init__.py @@ -5,7 +5,7 @@ from pyais.tracker import AISTracker, AISTrack __license__ = 'MIT' -__version__ = '2.7.1' +__version__ = '2.7.2' __author__ = 'Leon Morten Richter' __all__ = ( diff --git a/pyais/stream.py b/pyais/stream.py index 43b124b..9814e61 100644 --- a/pyais/stream.py +++ b/pyais/stream.py @@ -1,7 +1,7 @@ import typing import pathlib from abc import ABC, abstractmethod -from socket import AF_INET, SO_REUSEPORT, SOCK_DGRAM, SOCK_STREAM, SOL_SOCKET, socket +from socket import AF_INET, SOCK_DGRAM, SOCK_STREAM, socket from typing import BinaryIO, Generator, Generic, Iterable, List, TypeVar, cast from pyais.exceptions import InvalidNMEAMessageException, NonPrintableCharacterException, UnknownMessageException @@ -285,10 +285,8 @@ def read(self) -> Generator[bytes, None, None]: class UDPReceiver(SocketStream): - def __init__(self, host: str, port: int, preprocessor: typing.Optional[PreprocessorProtocol] = None, reusable: bool = False) -> None: + def __init__(self, host: str, port: int, preprocessor: typing.Optional[PreprocessorProtocol] = None) -> None: sock: socket = socket(AF_INET, SOCK_DGRAM) - if reusable: - sock.setsockopt(SOL_SOCKET, SO_REUSEPORT, 1) sock.bind((host, port)) super().__init__(sock, preprocessor=preprocessor)