|
1 |
| -# The MIT License (MIT) |
| 1 | +# SPDX-FileCopyrightText: 2010 WIZnet |
| 2 | +# SPDX-FileCopyrightText: 2010 Arduino LLC |
| 3 | +# SPDX-FileCopyrightText: 2008 Bjoern Hartmann |
| 4 | +# SPDX-FileCopyrightText: 2018 Paul Stoffregen |
| 5 | +# SPDX-FileCopyrightText: 2020 Brent Rubell for Adafruit Industries |
| 6 | +# SPDX-FileCopyrightText: 2021 Patrick Van Oosterwijck |
2 | 7 | #
|
3 |
| -# Copyright (c) 2010 WIZnet |
4 |
| -# Copyright (c) 2010 Arduino LLC |
5 |
| -# Copyright (c) 2008 Bjoern Hartmann |
6 |
| -# Copyright 2018 Paul Stoffregen |
7 |
| -# Modified by Brent Rubell for Adafruit Industries, 2020 |
8 |
| -# Copyright (c) 2021 Patrick Van Oosterwijck |
9 |
| -# |
10 |
| -# Permission is hereby granted, free of charge, to any person obtaining a copy |
11 |
| -# of this software and associated documentation files (the "Software"), to deal |
12 |
| -# in the Software without restriction, including without limitation the rights |
13 |
| -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
14 |
| -# copies of the Software, and to permit persons to whom the Software is |
15 |
| -# furnished to do so, subject to the following conditions: |
16 |
| -# |
17 |
| -# The above copyright notice and this permission notice shall be included in |
18 |
| -# all copies or substantial portions of the Software. |
19 |
| -# |
20 |
| -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
21 |
| -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
22 |
| -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
23 |
| -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
24 |
| -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
25 |
| -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
26 |
| -# THE SOFTWARE. |
| 8 | +# SPDX-License-Identifier: MIT |
| 9 | + |
27 | 10 | """
|
28 | 11 | `adafruit_wiznet5k`
|
29 | 12 | ================================================================================
|
@@ -770,13 +753,17 @@ def socket_write(self, socket_num, buffer, timeout=0):
|
770 | 753 | while (
|
771 | 754 | self._read_socket(socket_num, REG_SNIR)[0] & SNIR_SEND_OK
|
772 | 755 | ) != SNIR_SEND_OK:
|
773 |
| - if self.socket_status(socket_num)[0] in ( |
774 |
| - SNSR_SOCK_CLOSED, |
775 |
| - SNSR_SOCK_TIME_WAIT, |
776 |
| - SNSR_SOCK_FIN_WAIT, |
777 |
| - SNSR_SOCK_CLOSE_WAIT, |
778 |
| - SNSR_SOCK_CLOSING, |
779 |
| - ) or (timeout and time.monotonic() - stamp > timeout): |
| 756 | + if ( |
| 757 | + self.socket_status(socket_num)[0] |
| 758 | + in ( |
| 759 | + SNSR_SOCK_CLOSED, |
| 760 | + SNSR_SOCK_TIME_WAIT, |
| 761 | + SNSR_SOCK_FIN_WAIT, |
| 762 | + SNSR_SOCK_CLOSE_WAIT, |
| 763 | + SNSR_SOCK_CLOSING, |
| 764 | + ) |
| 765 | + or (timeout and time.monotonic() - stamp > timeout) |
| 766 | + ): |
780 | 767 | # self.socket_close(socket_num)
|
781 | 768 | return 0
|
782 | 769 | time.sleep(0.01)
|
|
0 commit comments