Skip to content

Commit 95871c9

Browse files
author
BiffoBear
committed
Refactored two constants that were protected. Fixed a typo.
1 parent e28f87e commit 95871c9

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

adafruit_wiznet5k/adafruit_wiznet5k.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@
8484
SNSR_SOCK_ESTABLISHED = const(0x17)
8585
SNSR_SOCK_FIN_WAIT = const(0x18)
8686
_SNSR_SOCK_CLOSING = const(0x1A)
87-
_SNSR_SOCK_TIME_WAIT = const(0x1B)
88-
_SNSR_SOCK_CLOSE_WAIT = const(0x1C)
87+
SNSR_SOCK_TIME_WAIT = const(0x1B)
88+
SNSR_SOCK_CLOSE_WAIT = const(0x1C)
8989
_SNSR_SOCK_LAST_ACK = const(0x1D)
9090
_SNSR_SOCK_UDP = const(0x22)
9191
_SNSR_SOCK_IPRAW = const(0x32)
@@ -826,9 +826,9 @@ def socket_open(self, socket_num: int, conn_mode: int = _SNMR_TCP) -> int:
826826
status = self._read_snsr(socket_num)[0]
827827
if status in (
828828
SNSR_SOCK_CLOSED,
829-
_SNSR_SOCK_TIME_WAIT,
829+
SNSR_SOCK_TIME_WAIT,
830830
SNSR_SOCK_FIN_WAIT,
831-
_SNSR_SOCK_CLOSE_WAIT,
831+
SNSR_SOCK_CLOSE_WAIT,
832832
_SNSR_SOCK_CLOSING,
833833
_SNSR_SOCK_UDP,
834834
):
@@ -906,7 +906,7 @@ def socket_read( # pylint: disable=too-many-branches
906906
if ret == 0:
907907
# no data on socket?
908908
status = self._read_snmr(socket_num)
909-
if status in (SNSR_SOCK_LISTEN, SNSR_SOCK_CLOSED, _SNSR_SOCK_CLOSE_WAIT):
909+
if status in (SNSR_SOCK_LISTEN, SNSR_SOCK_CLOSED, SNSR_SOCK_CLOSE_WAIT):
910910
# remote end closed its side of the connection, EOF state
911911
ret = 0
912912
resp = 0
@@ -1004,7 +1004,7 @@ def socket_write(
10041004
while free_size < ret:
10051005
free_size = self._get_tx_free_size(socket_num)
10061006
status = self.socket_status(socket_num)[0]
1007-
if status not in (SNSR_SOCK_ESTABLISHED, _SNSR_SOCK_CLOSE_WAIT) or (
1007+
if status not in (SNSR_SOCK_ESTABLISHED, SNSR_SOCK_CLOSE_WAIT) or (
10081008
timeout and time.monotonic() - stamp > timeout
10091009
):
10101010
ret = 0
@@ -1049,9 +1049,9 @@ def socket_write(
10491049
) != _SNIR_SEND_OK:
10501050
if self.socket_status(socket_num)[0] in (
10511051
SNSR_SOCK_CLOSED,
1052-
_SNSR_SOCK_TIME_WAIT,
1052+
SNSR_SOCK_TIME_WAIT,
10531053
SNSR_SOCK_FIN_WAIT,
1054-
_SNSR_SOCK_CLOSE_WAIT,
1054+
SNSR_SOCK_CLOSE_WAIT,
10551055
_SNSR_SOCK_CLOSING,
10561056
) or (timeout and time.monotonic() - stamp > timeout):
10571057
# self.socket_close(socket_num)

adafruit_wiznet5k/adafruit_wiznet5k_socket.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,15 +271,15 @@ def _connected(self) -> bool:
271271
return False
272272
status = _the_interface.socket_status(self._socknum)[0]
273273
if (
274-
status == wiznet5k.adafruit_wiznet5k._SNSR_SOCK_CLOSE_WAIT
274+
status == wiznet5k.adafruit_wiznet5k.SNSR_SOCK_CLOSE_WAIT
275275
and self._available() == 0
276276
):
277277
result = False
278278
else:
279279
result = status not in (
280280
wiznet5k.adafruit_wiznet5k.SNSR_SOCK_CLOSED,
281281
wiznet5k.adafruit_wiznet5k.SNSR_SOCK_LISTEN,
282-
wiznet5k.adafruit_wiznet5k._SNSR_SOCK_TIME_WAIT,
282+
wiznet5k.adafruit_wiznet5k.SNSR_SOCK_TIME_WAIT,
283283
wiznet5k.adafruit_wiznet5k.SNSR_SOCK_FIN_WAIT,
284284
)
285285
if not result and status != wiznet5k.adafruit_wiznet5k.SNSR_SOCK_LISTEN:
@@ -609,7 +609,7 @@ def settimeout(self, value: Optional[float]) -> None:
609609
If zero is given, the socket is put in non-blocking mode. If None is given,
610610
the socket is put in blocking mode..
611611
612-
:param fOptional[float] value: Socket read timeout in seconds.
612+
:param Optional[float] value: Socket read timeout in seconds.
613613
"""
614614
if value is None or (isinstance(value, (int, float)) and value >= 0):
615615
self._timeout = value

0 commit comments

Comments
 (0)