wisp-python 0.6.0__py3-none-any.whl → 0.6.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
wisp/server/connection.py CHANGED
@@ -128,7 +128,7 @@ class WispConnection:
128
128
 
129
129
  #send a CONTINUE packet periodically
130
130
  stream["packets_sent"] += 1
131
- if stream["packets_sent"] % queue_size / 4 == 0:
131
+ if stream["packets_sent"] % (queue_size // 4) == 0:
132
132
  buffer_remaining = stream["queue"].maxsize - stream["queue"].qsize()
133
133
  continue_payload = struct.pack(continue_format, buffer_remaining)
134
134
  continue_packet = struct.pack(packet_format, 0x03, stream_id) + continue_payload
@@ -4,7 +4,7 @@ import logging
4
4
  import queue
5
5
  import threading
6
6
 
7
- from websockets.exceptions import ConnectionClosed
7
+ from websockets.exceptions import ConnectionClosed, ConnectionClosedError
8
8
 
9
9
  from wisp.server import ratelimit
10
10
  from wisp.server.threading import netsync
@@ -41,7 +41,7 @@ class WSProxyConnection:
41
41
  while True:
42
42
  try:
43
43
  data = self.ws.recv()
44
- except ConnectionClosed:
44
+ except (ConnectionClosed, ConnectionClosedError) as e:
45
45
  break
46
46
 
47
47
  ratelimit.limit_client_bandwidth_sync(self.client_ip, len(data), "ws")
@@ -127,7 +127,7 @@ class WispConnection:
127
127
 
128
128
  #send a CONTINUE packet periodically
129
129
  stream["packets_sent"] += 1
130
- if stream["packets_sent"] % queue_size / 4 == 0:
130
+ if stream["packets_sent"] % (queue_size // 4) == 0:
131
131
  buffer_remaining = stream["queue"].maxsize - stream["queue"].qsize()
132
132
  continue_payload = struct.pack(continue_format, buffer_remaining)
133
133
  continue_packet = struct.pack(packet_format, 0x03, stream_id) + continue_payload
@@ -149,7 +149,10 @@ class WispConnection:
149
149
  data_header = struct.pack(packet_format, 0x02, stream_id)
150
150
 
151
151
  ratelimit.limit_client_bandwidth_sync(self.client_ip, len(data_header)+len(data), "tcp")
152
- self.ws.send(data_header + data)
152
+ try:
153
+ self.ws.send(data_header + data)
154
+ except (ConnectionClosed, ConnectionClosedError) as e:
155
+ return
153
156
 
154
157
  self.send_close_packet(stream_id, 0x02)
155
158
  self.close_stream(stream_id)
@@ -178,7 +181,7 @@ class WispConnection:
178
181
  while True:
179
182
  try:
180
183
  data = self.ws.recv()
181
- except ConnectionClosed:
184
+ except (ConnectionClosed, ConnectionClosedError):
182
185
  break
183
186
  except Exception as e:
184
187
  logging.warn(f"({self.id}) Receiving data from websocket failed: {e}")
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: wisp-python
3
- Version: 0.6.0
3
+ Version: 0.6.1
4
4
  Summary: An implementation of a Wisp proxy server in Python
5
5
  Author: ading2210
6
6
  Project-URL: Homepage, https://github.com/MercuryWorkshop/wisp-server-python
@@ -14,6 +14,7 @@ License-File: LICENSE
14
14
  Requires-Dist: websockets
15
15
  Requires-Dist: asyncudp
16
16
  Requires-Dist: uvloop; sys_platform != "win32" and sys_platform != "cygwin"
17
+ Dynamic: license-file
17
18
 
18
19
  # Python Wisp Server
19
20
 
@@ -3,17 +3,17 @@ wisp/util.py,sha256=AU7si8VwJqS8Dwc1PT2pu_f_9Y32GQxivRYwJ3-U0YQ,144
3
3
  wisp/server/__init__.py,sha256=LmgQ1nTlnqcTPqRJVc1NGapV9qVR-BK8iPVUMSJ74Qs,102
4
4
  wisp/server/__main__.py,sha256=oEDuHOpC7DaHTFIX-9HViwOmWJqdIyktA8whRTmGesk,610
5
5
  wisp/server/common.py,sha256=0NheE8nJeUmAMPt-DomesnkqCvB8gITi-dsT7VBRJCw,1442
6
- wisp/server/connection.py,sha256=Jj0doAJj-4Ks_VpeEEyBUB6ti-kkQMIhjUs2ix3AP8I,7666
6
+ wisp/server/connection.py,sha256=V_Skmmsvn30lQKY5w9x2rJQFR_FsA3lngNDpaYOfX6U,7669
7
7
  wisp/server/http.py,sha256=YL-N3ajptgcAq5P50V6b8KlSJlVo6fRPnz65El9ZUQY,3145
8
8
  wisp/server/net.py,sha256=3EL5FzM9BAF2VW6ysTFX1vyJG4xMvrcu_YMlxTYqhI8,2265
9
9
  wisp/server/ratelimit.py,sha256=cic_rlBaM-tp6kJaSz4ITGvUbsX4JLSGSUgF5cPO0FY,1926
10
10
  wisp/server/threading/__init__.py,sha256=_34ZRPKommA9uazP9UBw59EByf6m9-VGNqc7hAjaJkc,122
11
11
  wisp/server/threading/__main__.py,sha256=xM65KttaBDFg3FS5H5msEkx3p-mPfP7grpGslqKG4uY,146
12
- wisp/server/threading/connection.py,sha256=hgBg6tgKOQ3sPDb4B1kO62-X4vipKeCDXELTFpIgKQ8,6874
12
+ wisp/server/threading/connection.py,sha256=2bMEPBxMl28OAVehNS3sk4C33dECZCHKBZSHTkEzZoM,7044
13
13
  wisp/server/threading/http.py,sha256=0pzsHVrJoP4QZ9yNPPZYGStah9g3pJZvNMGbzVBRk5w,3521
14
14
  wisp/server/threading/netsync.py,sha256=7RBlLhEtrF1fsWUIt6aGeoD_lUui2Q83FJdEhi5gnTY,1462
15
- wisp_python-0.6.0.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
16
- wisp_python-0.6.0.dist-info/METADATA,sha256=zOrd-35XwdSDv2ZnNTUu1zoA8VTdS8B25zUrjmzPP4Q,4061
17
- wisp_python-0.6.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
18
- wisp_python-0.6.0.dist-info/top_level.txt,sha256=sv0LDAu8cHUc3_VTsCKfXU-6B9HdV4dW22ubeW8KPVs,5
19
- wisp_python-0.6.0.dist-info/RECORD,,
15
+ wisp_python-0.6.1.dist-info/licenses/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
16
+ wisp_python-0.6.1.dist-info/METADATA,sha256=YE9Ent8HbMHBW95GSgF8irmLlOxRWEDpMcyCCS7r3Fg,4083
17
+ wisp_python-0.6.1.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
18
+ wisp_python-0.6.1.dist-info/top_level.txt,sha256=sv0LDAu8cHUc3_VTsCKfXU-6B9HdV4dW22ubeW8KPVs,5
19
+ wisp_python-0.6.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.6.0)
2
+ Generator: setuptools (80.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5