Skip to content

Commit 77b5690

Browse files
authored
Fix a bug with allocating memory for the UnifexPayload pointer instead of an actual UnifexPayload.c Set the flag allowing empty epoll (#8)
1 parent 4a0a2a0 commit 77b5690

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The package exposes a server and a client module to interact with SRT streams.
1313
```elixir
1414
def deps do
1515
[
16-
{:ex_libsrt, "~> 0.1.1"}
16+
{:ex_libsrt, "~> 0.1.2"}
1717
]
1818
end
1919
```

c_src/ex_libsrt/server/server.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ void Server::CloseConnection(int connection_id) {
8080
}
8181

8282
void Server::RunEpoll() {
83+
// Setting this one prevents spamming with "no sockets to check, this would deadlock" logs during closing
84+
// of the system, when there are no sockets in the epoll anymore
85+
srt_epoll_set(epoll, SRT_EPOLL_ENABLE_EMPTY);
86+
8387
int sockets_len = 100;
8488
SrtSocket sockets[sockets_len];
8589

c_src/ex_libsrt/srt_nif.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ UNIFEX_TERM start_server(UnifexEnv* env, char* address, int port, char* password
145145
state->server->SetOnSocketData(
146146
[=](Server::SrtSocket socket, const char* data, int len) {
147147
UnifexPayload* payload =
148-
(UnifexPayload*)unifex_alloc(sizeof(UnifexPayload*));
148+
(UnifexPayload*)unifex_alloc(sizeof(UnifexPayload));
149149

150150
unifex_payload_alloc(state->env, UNIFEX_PAYLOAD_BINARY, len, payload);
151151

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
defmodule ExLibSRT.MixProject do
22
use Mix.Project
33

4-
@version "0.1.1"
4+
@version "0.1.2"
55
@github_url "https://github.com/membraneframework/ex_libsrt"
66

77
def project do

0 commit comments

Comments
 (0)