diff --git a/src/paho/mqtt/client.py b/src/paho/mqtt/client.py index 7bb10bef..76c601d7 100644 --- a/src/paho/mqtt/client.py +++ b/src/paho/mqtt/client.py @@ -34,7 +34,6 @@ import urllib.parse import urllib.request import uuid -import warnings from typing import TYPE_CHECKING, Any, Callable, Dict, Iterator, List, Sequence, Tuple, Union from .enums import ConnackCode, ConnectionState, LogLevel, MessageState, MessageType, MQTTErrorCode, MQTTProtocolVersion, PahoClientMode @@ -783,11 +782,7 @@ def keepalive(self, value: int) -> None: if self._sock is not None: # The issue here is that the previous value of keepalive matter to possibly # sent ping packet. - warnings.warn( - "updating keepalive on established connection is not supported", - stacklevel=2, - ) - self._sock.settimeout(value) + raise RuntimeError("updating keepalive on established connection is not supported") if value < 0: raise ValueError("Keepalive must be >=0.") @@ -877,10 +872,7 @@ def max_inflight_messages(self, value: int) -> None: if self._sock is not None: # Not tested. Some doubt that everything is okay when max_inflight change between 0 # and > 0 value because _update_inflight is skipped when _max_inflight_messages == 0 - warnings.warn( - "updating max_inflight_messages on established connection is not supported", - stacklevel=2, - ) + raise RuntimeError("updating max_inflight_messages on established connection is not supported") if value < 0: raise ValueError("Invalid inflight.") @@ -897,10 +889,7 @@ def max_queued_messages(self, value: int) -> None: "Update max_queued_messages. It's behavior is undefined if the connection is already open" if self._sock is not None: # Not tested. - warnings.warn( - "updating max_queued_messages on established connection is not supported", - stacklevel=2, - ) + raise RuntimeError("updating max_queued_messages on established connection is not supported") if value < 0: raise ValueError("Invalid queue size.")