sepfy/libpeer

A suggestion for peer_connection_loop

Closed this issue · 0 comments

Hi, I have an idea about the function peer_connection_loop in peer_connection.c. You can refer to my PR and weigh whether it is useful.
(PS. PR maybe not fit for the project, and present here for reference only.)

Because peer_connection_loop processes sending media data, sending data-channel data, and receiving/parsing data together
If they are simply separated, there may be the following benefits:

  1. It can make the code clearer and more maintainable
  2. Threads can be allocated according to needs of user.
    Can allocate only one thread to process the business of peer_connection_loop as before
    Or allocate a sender thread to process peer_connection_sender_loop and a separate thread to call peer_connection_common_loop to process regular reception/parsing