-
Notifications
You must be signed in to change notification settings - Fork 906
Added configuration object to group connection structure #1314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added configuration object to group connection structure #1314
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general looks good. This would give the flexibility in configuring each socket in a group.
The folowing API functions are added:
srt_create_config(..)
srt_delete_config(..)
srt_config_add(..)
- Maybe some consestent naming could be used?
srt_config_*(..)
? Although there is the same with the group API naming. srt_config_remove(..)
could be useful as well, but I guess it can be easily added later on request.
It might be good to create a separate source files for the configuration object. |
I understand the necessity to trim out the fat of |
…n result. Changed all-fail result to CONNLOST.
Confirming the idea to have
|
I think the deletion of the object should be done by the upstream app. |
The idea is that the configuration object should only be deleted in case when you decided that you don't need to make a connection. Don't forget that this is a C API and any simplification here will be welcome. In short: you need to perform deletion only if this object has been created, but you are somehow unable to call the Just as an additional help, pointers to objects that have been "eaten up" by the connection function are reset to NULL. So the user should simply fill the |
Usage example SRT_SOCKGROUPCONFIG data [] = {
srt_prepare_endpoint( ... 1 ... ),
srt_perpare_endpoint( ... 2 ... )
};
data[0].config = srt_create_config();
srt_config_add(data[0].config, SRT_BINDTODEVICE, "eth0", 4);
data[1].config = srt_create_config();
srt_config_add(data[1].config, SRT_BINDTODEVICE, "eth1", 4);
size_t len = sizeof data;
srt_connect_group(grp, data, len);
// if srt_connect_group suceeded, then data[i].config will be nullptr
for (auto& d: data)
srt_delete_config(d.config); |
Sharing the same config is prohibited, and will cause a crash(?) SRT_SOCKGROUPCONFIG data [] = {
srt_prepare_endpoint( ... 1 ... ),
srt_perpare_endpoint( ... 2 ... )
};
SRT_SOCKOPT_CONFIG* config = srt_create_config();
srt_config_add(config, SRT_BINDTODEVICE, "eth0", sizeof int);
data[0].config = config;
data[1].config = config;
size_t len = sizeof data;
// Crash on deleting already deleted obect
srt_connect_group(grp, data, len);
// if srt_connect_group suceeded, then data[i].config will be nullptr
for (auto& d: data)
srt_delete_config(d.config); |
In the current proposal, IF |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unanonimous decision: the srt_connect_group
should not delete the data.
Config object is to be deleted only by the app via srt_delete_config
.
Requesting changes.
Fixes #1309
Contents:
Added management for a configuration object. The configuration object is dynamically created (there's unfortunately no other way in C API). After the connection process those objects should be deleted (deletion can be done anyway and on a NULL object it will simply do nothing). The configuration object is a container that contains options to be set on the socket prior to connecting. These options apply AFTER the options derived through the group are set.
The testing application is now capable of specifying single socket options using
srto.
prefix attached to the node specification in an argument-separate syntax.