mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-21 01:40:15 +00:00
control socket: removed a duplicite function
already defined in utils/net.c
This commit is contained in:
@@ -153,24 +153,6 @@ static void new_message(struct module *m) {
|
||||
}
|
||||
}
|
||||
|
||||
static int get_bound_port(fd_t fd, int ip_version){
|
||||
assert(ip_version == 4 || ip_version == 6);
|
||||
sockaddr_storage ss;
|
||||
socklen_t s_len = sizeof(ss);
|
||||
|
||||
int rc = getsockname(fd, reinterpret_cast<struct sockaddr *>(&ss), &s_len);
|
||||
if(rc != 0)
|
||||
return -1;
|
||||
|
||||
if(ip_version == 4){
|
||||
auto *s_in = reinterpret_cast<struct sockaddr_in *>(&ss);
|
||||
return ntohs(s_in->sin_port);
|
||||
}
|
||||
|
||||
auto *s_in6 = reinterpret_cast<struct sockaddr_in6 *>(&ss);
|
||||
return ntohs(s_in6->sin6_port);
|
||||
}
|
||||
|
||||
int control_init(int port, int connection_type, struct control_state **state, struct module *root_module, int force_ip_version)
|
||||
{
|
||||
control_state *s = new control_state();
|
||||
@@ -251,7 +233,7 @@ int control_init(int port, int connection_type, struct control_state **state, st
|
||||
goto error;
|
||||
}
|
||||
log_msg(LOG_LEVEL_NOTICE, "Control socket listening on port %d\n",
|
||||
get_bound_port(s->socket_fd, ip_version));
|
||||
socket_get_recv_port(s->socket_fd));
|
||||
}
|
||||
} else {
|
||||
if (force_ip_version == 6) {
|
||||
|
||||
Reference in New Issue
Block a user