-
Notifications
You must be signed in to change notification settings - Fork 18
Update libmoq to 0.3.6; rework MoQ source teardown to fix use-after-free #44
Changes from 3 commits
13c1c11
ffcd5c4
609cd9a
ea3b517
4a4d48c
9e9334f
f1d39ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -75,17 +75,20 @@ bool MoQOutput::Start() | |||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| connect_start = std::chrono::steady_clock::now(); | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| // Create a callback to log when the session is connected or closed | ||||||||||||||||||||||||||||||||||||||||||||||
| auto session_connect_callback = [](void *user_data, int error_code) { | ||||||||||||||||||||||||||||||||||||||||||||||
| // Create a callback to log when the session is connected or closed. | ||||||||||||||||||||||||||||||||||||||||||||||
| // libmoq status codes (>= 0.3.0): > 0 = (re)connected (epoch), 0 = closed | ||||||||||||||||||||||||||||||||||||||||||||||
| // cleanly (terminal), < 0 = fatal/reconnect-gave-up (terminal). | ||||||||||||||||||||||||||||||||||||||||||||||
| auto session_connect_callback = [](void *user_data, int code) { | ||||||||||||||||||||||||||||||||||||||||||||||
| auto self = static_cast<MoQOutput *>(user_data); | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| if (error_code == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||
| if (code > 0) { | ||||||||||||||||||||||||||||||||||||||||||||||
| auto elapsed = std::chrono::steady_clock::now() - self->connect_start; | ||||||||||||||||||||||||||||||||||||||||||||||
| self->connect_time_ms = static_cast<int>(std::chrono::duration_cast<std::chrono::milliseconds>(elapsed).count()); | ||||||||||||||||||||||||||||||||||||||||||||||
| LOG_INFO("MoQ session established (%d ms): %s", self->connect_time_ms, | ||||||||||||||||||||||||||||||||||||||||||||||
| self->connect_time_ms = static_cast<int>( | ||||||||||||||||||||||||||||||||||||||||||||||
| std::chrono::duration_cast<std::chrono::milliseconds>(elapsed).count()); | ||||||||||||||||||||||||||||||||||||||||||||||
| LOG_INFO("MoQ session connected (%d ms, epoch %d): %s", self->connect_time_ms, code, | ||||||||||||||||||||||||||||||||||||||||||||||
| self->server_url.c_str()); | ||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| LOG_INFO("MoQ session closed (%d): %s", error_code, self->server_url.c_str()); | ||||||||||||||||||||||||||||||||||||||||||||||
| LOG_INFO("MoQ session closed (%d): %s", code, self->server_url.c_str()); | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+93
to
107
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical: Reset When 🐛 Proposed fix to reset connection time on close if (code > 0) {
auto elapsed = std::chrono::steady_clock::now() - self->connect_start;
self->connect_time_ms = static_cast<int>(
std::chrono::duration_cast<std::chrono::milliseconds>(elapsed).count());
LOG_INFO("MoQ session connected (%d ms, epoch %d): %s", self->connect_time_ms, code,
self->server_url.c_str());
} else {
+ self->connect_time_ms = 0;
LOG_INFO("MoQ session closed (%d): %s", code, self->server_url.c_str());
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.