Skip to content

Commit

Permalink
add a stream publisher for the client
Browse files Browse the repository at this point in the history
  • Loading branch information
Hlamallama committed Nov 20, 2024
1 parent 3fc9d56 commit 3144bac
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/vumi2/transports/smpp/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from smpp.pdu.pdu_encoding import PDUEncoder # type: ignore
from smpp.pdu.pdu_types import PDU, AddrNpi, AddrTon, CommandStatus # type: ignore
from trio import (
MemoryReceiveChannel,
MemorySendChannel,
Nursery,
SocketStream,
Expand Down Expand Up @@ -98,6 +99,8 @@ def __init__(
self.buffer = bytearray()
self.responses: dict[int, MemorySendChannel] = {}
self.encoder = PDUEncoder()
self.pdu_send_channel: MemorySendChannel
self.pdu_receive_channel: MemoryReceiveChannel
self.pdu_send_channel, self.pdu_receive_channel = open_memory_channel(0)

async def start(self) -> None:
Expand Down Expand Up @@ -243,6 +246,8 @@ async def send_pdu(
await self.pdu_send_channel.send(pdu)
return None

send_channel: MemorySendChannel
receive_channel: MemoryReceiveChannel
send_channel, receive_channel = open_memory_channel(0)
self.responses[pdu.seqNum] = send_channel

Expand Down

0 comments on commit 3144bac

Please sign in to comment.