mirror of
https://github.com/google/bumble.git
synced 2026-05-09 04:08:02 +00:00
rename .run to .spawn
This commit is contained in:
@@ -323,7 +323,7 @@ class Receiver:
|
|||||||
self.expected_packet_index = packet_index + 1
|
self.expected_packet_index = packet_index + 1
|
||||||
|
|
||||||
if packet_flags & PACKET_FLAG_LAST:
|
if packet_flags & PACKET_FLAG_LAST:
|
||||||
AsyncRunner.run(
|
AsyncRunner.spawn(
|
||||||
self.packet_io.send_packet(
|
self.packet_io.send_packet(
|
||||||
struct.pack('>bbI', PacketType.ACK, packet_flags, packet_index)
|
struct.pack('>bbI', PacketType.ACK, packet_flags, packet_index)
|
||||||
)
|
)
|
||||||
@@ -423,7 +423,7 @@ class Ping:
|
|||||||
self.done.set()
|
self.done.set()
|
||||||
return
|
return
|
||||||
|
|
||||||
AsyncRunner.run(self.send_next_ping())
|
AsyncRunner.spawn(self.send_next_ping())
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
@@ -472,7 +472,7 @@ class Pong:
|
|||||||
|
|
||||||
self.expected_packet_index = packet_index + 1
|
self.expected_packet_index = packet_index + 1
|
||||||
|
|
||||||
AsyncRunner.run(
|
AsyncRunner.spawn(
|
||||||
self.packet_io.send_packet(
|
self.packet_io.send_packet(
|
||||||
struct.pack('>bbI', PacketType.ACK, packet_flags, packet_index)
|
struct.pack('>bbI', PacketType.ACK, packet_flags, packet_index)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -191,9 +191,9 @@ class AsyncRunner:
|
|||||||
return decorator
|
return decorator
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def run(coroutine):
|
def spawn(coroutine):
|
||||||
"""
|
"""
|
||||||
Create a task to run a coroutine in a "fire and forget" task.
|
Spawn a task to run a coroutine in a "fire and forget" mode.
|
||||||
|
|
||||||
Using this method instead of just calling `asyncio.create_task(coroutine)`
|
Using this method instead of just calling `asyncio.create_task(coroutine)`
|
||||||
is necessary when you don't keep a reference to the task, because `asyncio`
|
is necessary when you don't keep a reference to the task, because `asyncio`
|
||||||
|
|||||||
Reference in New Issue
Block a user