File tree Expand file tree Collapse file tree 2 files changed +7
-12
lines changed Expand file tree Collapse file tree 2 files changed +7
-12
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,9 @@ void Server::Run(const char* address, int port) {
2828 throw std::runtime_error (std::string (srt_getlasterror_str ()));
2929 }
3030
31+ srt_listen_callback (srt_sock,
32+ (srt_listen_callback_fn*)&Server::ListenAcceptCallback,
33+ (void *)this );
3134 srt_bind_sock = srt_listen (srt_sock, MAX_PENDING_CONNECTIONS);
3235 if (srt_bind_sock == SRT_ERROR) {
3336 throw std::runtime_error (std::string (srt_getlasterror_str ()));
@@ -41,10 +44,6 @@ void Server::Run(const char* address, int port) {
4144 const int read_modes = SRT_EPOLL_IN | SRT_EPOLL_ERR;
4245 srt_epoll_add_usock (epoll, srt_sock, &read_modes);
4346
44- srt_listen_callback (srt_sock,
45- (srt_listen_callback_fn*)&Server::ListenAcceptCallback,
46- (void *)this );
47-
4847 running.store (true );
4948
5049 epoll_loop = std::thread (&Server::RunEpoll, this );
Original file line number Diff line number Diff line change 1- Mix . install ( [ { :ex_libsrt , path: "../ex_libsrt" } ] )
2-
1+ Mix . install ( [ { :ex_libsrt , path: "../" } ] )
32
43defmodule Server do
54 use GenServer
@@ -19,7 +18,9 @@ defmodule Server do
1918
2019 @ impl true
2120 def handle_info ( { :srt_server_connect_request , address , stream_id } , state ) do
22- Logger . info ( "Receiving new connection request with stream id: #{ stream_id } from address: #{ address } " )
21+ Logger . info (
22+ "Receiving new connection request with stream id: #{ stream_id } from address: #{ address } "
23+ )
2324
2425 :ok = ExLibSRT.Server . accept_awaiting_connect_request ( state . server )
2526
@@ -64,20 +65,15 @@ receive do
6465end
6566
6667# Process.sleep(2_000)
67- #
6868for _i <- 1 .. 10_000 do
6969 payload = :crypto . strong_rand_bytes ( 1200 )
70-
7170 :ok = ExLibSRT.Client . send_data ( payload , client )
7271end
7372
74-
75-
7673Process . sleep ( 5000 )
7774
7875ExLibSRT.Client . stop ( client )
7976
8077Process . sleep ( 1000 )
8178
8279GenServer . stop ( server )
83-
You can’t perform that action at this time.
0 commit comments