How to handle multiple connections contexts ? #1809
Unanswered
tarundjoshi
asked this question in
Q&A
Replies: 1 comment
-
I assume that you have two threads, one for running the protocol and one for populating the queues. You can achieve that by starting the "socket loop" as a background thread -- see for example the code in Once picoquic is running in the background, you should do the following after adding a message to one of the queues:
Picoquic will then do a callback |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to create a server where server must send data that will be provided dynamically as user input to send to a particular connection.
For each connection and each stream there is a separate send and receive queue which I have created.
I am currently using Just in time api to send data on a stream from the queues.
I am wondering how to activate the stream when there is data to send on a specific connection ( from server side ) ? Since a new context is created for each new connection, how can I make the server side decide which connection and which stream to activate when data is available to send?
The main thing is that the stream data callback has contexts specific to the connection, however I want to be able to view all connections simultaneously outside the callback to decide when to activate stream for a particular connection.
One temporary fix for this would be to maintain a map of maybe an IP, port number to the corresponding connection context, and add data to a queue on some stream, and activate that stream.
Is there a better way to do this?
Beta Was this translation helpful? Give feedback.
All reactions