Revision 07dd477d src/janus_instance.c

View differences:

src/janus_instance.c
23 23
#include<debug.h>
24 24
#include<unistd.h>
25 25
#include<tokens.h>
26
#include<name_lengths.h>
26 27
#include<grapes_config.h>
27 28
#include <sys/prctl.h>  // for process sync
28 29

  
......
102 103
struct janus_instance * janus_instance_create(struct mg_mgr *mongoose_srv, struct task_manager *tm, const char *config)
103 104
{
104 105
	struct janus_instance * ji = NULL;
106
	char * ptr = NULL;
105 107
	struct tag* tags;
106 108

  
107 109
	if (mongoose_srv && tm)
......
111 113
		ji = malloc(sizeof(struct janus_instance));
112 114
		ji->endpoint = strdup(grapes_config_value_str_default(tags, "janus_endpoint", "127.0.0.1:8088/janus"));
113 115
		ji->executable = strdup(grapes_config_value_str_default(tags, "janus_executable", "Tools/janus/bin/janus"));
114
		ji->conf_param = strdup(grapes_config_value_str_default(tags, "janus_param", "--configs-folder=Tools/janus_conf"));
116
		ji->conf_param = strdup(grapes_config_value_str_default(tags, "janus_param", "--configs-folder:Tools/janus_conf"));
117
		while ((ptr = strchr(ji->conf_param, ':')))
118
			*ptr='=';
119

  
115 120
		ji->logfile = strdup(grapes_config_value_str_default(tags, "janus_logfile", "janus.log"));
116 121
		ji->janus_pid = INVALID_PID;
117 122
		ji->management_session = 0;
......
602 607
	}
603 608
	return res;
604 609
}
610

  
611
const char * janus_instance_ipaddr(const struct janus_instance * janus)
612
{
613
	static char res[MAX_IPADDR_LENGTH];
614
    char *ptr;
615
	res[0] = '\0';
616

  
617
	if (janus && janus->endpoint)
618
	{
619
		ptr = strchr(janus->endpoint, ':');
620
		if (ptr)
621
		{
622
			strncpy(res, janus->endpoint, ptr - janus->endpoint);
623
			res[janus->endpoint - ptr] = '\0';
624
		} else
625
			strncpy(res, janus->endpoint, MAX_IPADDR_LENGTH);
626
	}
627
	return res;
628
}

Also available in: Unified diff