python-engineio 4.8.1__py3-none-any.whl → 4.8.2__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.
engineio/async_client.py CHANGED
@@ -15,6 +15,11 @@ from . import payload
15
15
 
16
16
  async_signal_handler_set = False
17
17
 
18
+ # this set is used to keep references to background tasks to prevent them from
19
+ # being garbage collected mid-execution. Solution taken from
20
+ # https://docs.python.org/3/library/asyncio-task.html#asyncio.create_task
21
+ task_reference_holder = set()
22
+
18
23
 
19
24
  def async_signal_handler():
20
25
  """SIGINT handler.
@@ -450,8 +455,11 @@ class AsyncClient(base_client.BaseClient):
450
455
  if event in self.handlers:
451
456
  if asyncio.iscoroutinefunction(self.handlers[event]) is True:
452
457
  if run_async:
453
- return self.start_background_task(self.handlers[event],
458
+ task = self.start_background_task(self.handlers[event],
454
459
  *args)
460
+ task_reference_holder.add(task)
461
+ task.add_done_callback(task_reference_holder.discard)
462
+ return task
455
463
  else:
456
464
  try:
457
465
  ret = await self.handlers[event](*args)
@@ -468,7 +476,10 @@ class AsyncClient(base_client.BaseClient):
468
476
  async def async_handler():
469
477
  return self.handlers[event](*args)
470
478
 
471
- return self.start_background_task(async_handler)
479
+ task = self.start_background_task(async_handler)
480
+ task_reference_holder.add(task)
481
+ task.add_done_callback(task_reference_holder.discard)
482
+ return task
472
483
  else:
473
484
  try:
474
485
  ret = self.handlers[event](*args)
engineio/async_server.py CHANGED
@@ -6,6 +6,11 @@ from . import exceptions
6
6
  from . import packet
7
7
  from . import async_socket
8
8
 
9
+ # this set is used to keep references to background tasks to prevent them from
10
+ # being garbage collected mid-execution. Solution taken from
11
+ # https://docs.python.org/3/library/asyncio-task.html#asyncio.create_task
12
+ task_reference_holder = set()
13
+
9
14
 
10
15
  class AsyncServer(base_server.BaseServer):
11
16
  """An Engine.IO server for asyncio.
@@ -30,8 +35,11 @@ class AsyncServer(base_server.BaseServer):
30
35
  :param ping_timeout: The time in seconds that the client waits for the
31
36
  server to respond before disconnecting. The default
32
37
  is 20 seconds.
33
- :param max_http_buffer_size: The maximum size of a message. The default
34
- is 1,000,000 bytes.
38
+ :param max_http_buffer_size: The maximum size that is accepted for incoming
39
+ messages. The default is 1,000,000 bytes. In
40
+ spite of its name, the value set in this
41
+ argument is enforced for HTTP long-polling and
42
+ WebSocket connections.
35
43
  :param allow_upgrades: Whether to allow transport upgrades or not.
36
44
  :param http_compression: Whether to compress packages when using the
37
45
  polling transport.
@@ -484,6 +492,8 @@ class AsyncServer(base_server.BaseServer):
484
492
 
485
493
  if run_async:
486
494
  ret = self.start_background_task(run_async_handler)
495
+ task_reference_holder.add(ret)
496
+ ret.add_done_callback(task_reference_holder.discard)
487
497
  else:
488
498
  ret = await run_async_handler()
489
499
  else:
@@ -499,6 +509,8 @@ class AsyncServer(base_server.BaseServer):
499
509
 
500
510
  if run_async:
501
511
  ret = self.start_background_task(run_sync_handler)
512
+ task_reference_holder.add(ret)
513
+ ret.add_done_callback(task_reference_holder.discard)
502
514
  else:
503
515
  ret = await run_sync_handler()
504
516
  return ret
engineio/client.py CHANGED
@@ -309,7 +309,10 @@ class Client(base_client.BaseClient):
309
309
  self.ssl_verify = False
310
310
 
311
311
  if not self.ssl_verify:
312
- extra_options['sslopt'] = {"cert_reqs": ssl.CERT_NONE}
312
+ if 'sslopt' in extra_options:
313
+ extra_options['sslopt'].update({"cert_reqs": ssl.CERT_NONE})
314
+ else:
315
+ extra_options['sslopt'] = {"cert_reqs": ssl.CERT_NONE}
313
316
 
314
317
  # combine internally generated options with the ones supplied by the
315
318
  # caller. The caller's options take precedence.
engineio/server.py CHANGED
@@ -31,8 +31,11 @@ class Server(base_server.BaseServer):
31
31
  :param ping_timeout: The time in seconds that the client waits for the
32
32
  server to respond before disconnecting. The default
33
33
  is 20 seconds.
34
- :param max_http_buffer_size: The maximum size of a message. The default
35
- is 1,000,000 bytes.
34
+ :param max_http_buffer_size: The maximum size that is accepted for incoming
35
+ messages. The default is 1,000,000 bytes. In
36
+ spite of its name, the value set in this
37
+ argument is enforced for HTTP long-polling and
38
+ WebSocket connections.
36
39
  :param allow_upgrades: Whether to allow transport upgrades or not. The
37
40
  default is ``True``.
38
41
  :param http_compression: Whether to compress packages when using the
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-engineio
3
- Version: 4.8.1
3
+ Version: 4.8.2
4
4
  Summary: Engine.IO server and client for Python
5
5
  Author-email: Miguel Grinberg <miguel.grinberg@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/miguelgrinberg/python-engineio
@@ -1,17 +1,17 @@
1
1
  engineio/__init__.py,sha256=0R2PY1EXu3sicP7mkA0_QxEVGRlFlgvsxfhByqREE1A,481
2
- engineio/async_client.py,sha256=RgyPsoJCL68krJeAAZ512BFYXIttyQWzbJBKrXCasB0,27076
3
- engineio/async_server.py,sha256=k76ViVI0OhhtvcsxSN7Bu8fpHIYo2NFlI-pMozTUmBE,24329
2
+ engineio/async_client.py,sha256=d1Jg2sRo8NT2hDnq6KXj0mvIsLbLfnlfCwn7UDPNX-A,27637
3
+ engineio/async_server.py,sha256=gO7Tq1i4c3rSnN2zQdRrbVZIrPCI9ynjFqsqyIVLP80,25061
4
4
  engineio/async_socket.py,sha256=P8OZW1N5y7jr2hW1qLLK2y_Clt7aHdv2ucYW69mbU4Q,10305
5
5
  engineio/base_client.py,sha256=Q_w0Stvy89wPHwWk7411dRxpGjxNPypm4xy_4XMPZ9M,4872
6
6
  engineio/base_server.py,sha256=Em2RRpbohulKjmYTWHnf_lALKvTT_jHr442Rr2g_BEQ,14013
7
7
  engineio/base_socket.py,sha256=Bw6TWv1pnlXcDdqT59C5CyTaBi7l-_mkykIUuZLjz-g,400
8
- engineio/client.py,sha256=Cywmqfjti0RmAwHMNFmn2NJo8l2SIj1lZoWVSIyqXJ8,25535
8
+ engineio/client.py,sha256=DccBMvReANgUrF3icCjvM0jwID9y-lqUtTN0M-QTRg8,25676
9
9
  engineio/exceptions.py,sha256=FyuMb5qhX9CUYP3fEoe1m-faU96ApdQTSbblaaoo8LA,292
10
10
  engineio/json.py,sha256=SG5FTojqd1ix6u0dKXJsZVqqdYioZLO4S2GPL7BKl3U,405
11
11
  engineio/middleware.py,sha256=BF_qHAIZZnIbfiP256SD1CX3kzNWbSuto1cpih8oIFg,3766
12
12
  engineio/packet.py,sha256=ETMeLgdpZghXK9fth93IZO8pIft6Sg3d1QGpyTx4xBE,3189
13
13
  engineio/payload.py,sha256=2iLIFgIweTWkLok_UZ5zCgELmRSGyUUI5eeYcEerFSs,1547
14
- engineio/server.py,sha256=2Ci3Q0wbEPXDcf-6awV6VSkDVeM5zdk63HtrVabEG1c,21319
14
+ engineio/server.py,sha256=UegXydKobZaR1O0MxS_MENKNF7PBjpP_kPI0-OpI5EQ,21558
15
15
  engineio/socket.py,sha256=dasec3jXoV2eR1jmIrhEIfHzyUuuv8FwvxLB3DpyjeY,9996
16
16
  engineio/static_files.py,sha256=pwez9LQFaSQXMbtI0vLyD6UDiokQ4rNfmRYgVLKOthc,2064
17
17
  engineio/async_drivers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -24,8 +24,8 @@ engineio/async_drivers/gevent_uwsgi.py,sha256=cnjCsnDHTa6rKgwDKD6rLvIw1Yun-g4c1Q
24
24
  engineio/async_drivers/sanic.py,sha256=SY0HIp5DUHF7B55tJCBB_8qDjrRTD_FyNQ2cIwRIGR8,4538
25
25
  engineio/async_drivers/threading.py,sha256=ywmG59d4H6OHZjKarBN97-9BHEsRxFEz9YN-E9QAu_I,463
26
26
  engineio/async_drivers/tornado.py,sha256=9bB7FvY47Snx_h4rsNwRk5wIINf2ju7hXWTAqF3intA,5909
27
- python_engineio-4.8.1.dist-info/LICENSE,sha256=yel9Pbwfu82094CLKCzWRtuIev9PUxP-a76NTDFAWpw,1082
28
- python_engineio-4.8.1.dist-info/METADATA,sha256=3xVrBLi6niAX6yxAiEW5ksFbBjeXs8pOrKYqGj35vM8,2244
29
- python_engineio-4.8.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
30
- python_engineio-4.8.1.dist-info/top_level.txt,sha256=u8PmNisCZLwRYcWrNLe9wutQ2tt4zNi8IH362c-HWuA,9
31
- python_engineio-4.8.1.dist-info/RECORD,,
27
+ python_engineio-4.8.2.dist-info/LICENSE,sha256=yel9Pbwfu82094CLKCzWRtuIev9PUxP-a76NTDFAWpw,1082
28
+ python_engineio-4.8.2.dist-info/METADATA,sha256=1l6l4gW-F64FROlvz-r6AUpTSXHXeiKhAjZka0s02l8,2244
29
+ python_engineio-4.8.2.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
30
+ python_engineio-4.8.2.dist-info/top_level.txt,sha256=u8PmNisCZLwRYcWrNLe9wutQ2tt4zNi8IH362c-HWuA,9
31
+ python_engineio-4.8.2.dist-info/RECORD,,