Skip to content
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

Make TURN REST API timeout configurable in janus.jcfg #2470

Merged
merged 2 commits into from
Dec 3, 2020

Conversation

evorw
Copy link
Contributor

@evorw evorw commented Dec 3, 2020

No description provided.

@januscla
Copy link

januscla commented Dec 3, 2020

Thanks for your contribution, @evorw! Please make sure you sign our CLA, as it's a required step before we can merge this.

Copy link
Member

@lminiero lminiero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! I noticed some issues, though, that I've addressed inline.

turnrest.c Outdated
@@ -31,6 +31,7 @@
static const char *api_server = NULL;
static const char *api_key = NULL;
static gboolean api_http_get = FALSE;
static uint api_timeout = 10;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't look like the default here matters: it's always overwritten in janus_turnrest_set_backend.

@@ -32,7 +32,7 @@ void janus_turnrest_deinit(void);
* TURN REST API entirely)
* @param key The API key, if any (pass NULL if it's not required)
* @param method The HTTP method to use, POST or GET (NULL means POST) */
void janus_turnrest_set_backend(const char *server, const char *key, const char *method);
void janus_turnrest_set_backend(const char *server, const char *key, const char *method, const uint timeout);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to add the new attribute to the above doxygen documentation too.

janus.c Outdated
@@ -4643,6 +4643,7 @@ gint main(int argc, char *argv[])
char *turn_rest_api = NULL, *turn_rest_api_key = NULL;
#ifdef HAVE_TURNRESTAPI
char *turn_rest_api_method = NULL;
uint turn_rest_api_timeout = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like if turn_rest_api_timeout is not set in the config file, the above 0 value is passed to janus_ice_set_turn_rest_api, which then overwrites api_timeout inturnrest.c thus indeed causing the indefinite wait you wanted to prevent.

@@ -300,6 +300,7 @@ nat: {
#turn_rest_api = "http://yourbackend.com/path/to/api"
#turn_rest_api_key = "anyapikeyyoumayhaveset"
#turn_rest_api_method = "GET"
#turn_rest_api_timeout = 10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new property is not discussed in the text above. It should be explained that there's a configurable timeout, and that it's in seconds. As it is, people reading the file will just see 10 and not know what it means.

@evorw
Copy link
Contributor Author

evorw commented Dec 3, 2020

Thanks for the quick review, and for catching the error in default handling. Is this a better approach? I also addressed the documentation issues.

@lminiero
Copy link
Member

lminiero commented Dec 3, 2020

Thanks for the quick fixes! I see you signed the CLA and the code, so we can merge 👍

@lminiero lminiero merged commit 0e894a7 into meetecho:master Dec 3, 2020
@evorw evorw deleted the configurable-turnrest-timeout branch December 3, 2020 14:58
ricardo-salgado-tekever added a commit to ricardo-salgado-tekever/janus-gateway that referenced this pull request Dec 3, 2020
Make TURN REST API timeout configurable in janus.jcfg (meetecho#2470)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants