1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-11-03 04:17:17 -05:00

Feature: Support asking a listen socket for it's family

This commit is contained in:
Philipp Schafft 2022-03-06 18:26:20 +00:00
parent 4319e8c0e6
commit 80972517da
2 changed files with 17 additions and 0 deletions

View File

@ -799,6 +799,20 @@ listener_type_t listensocket_get_type(listensocket_t *self)
return ret; return ret;
} }
sock_family_t listensocket_get_family(listensocket_t *self)
{
sock_family_t ret;
if (!self)
return SOCK_FAMILY__ERROR;
thread_mutex_lock(&self->lock);
ret = sock_get_family(self->sock);
thread_mutex_unlock(&self->lock);
return ret;
}
#ifdef HAVE_POLL #ifdef HAVE_POLL
static inline int listensocket__poll_fill(listensocket_t *self, struct pollfd *p) static inline int listensocket__poll_fill(listensocket_t *self, struct pollfd *p)
{ {

View File

@ -9,6 +9,8 @@
#ifndef __LISTENSOCKET_H__ #ifndef __LISTENSOCKET_H__
#define __LISTENSOCKET_H__ #define __LISTENSOCKET_H__
#include "common/net/sock.h"
#include "icecasttypes.h" #include "icecasttypes.h"
#include "refobject.h" #include "refobject.h"
#include "cfgfile.h" #include "cfgfile.h"
@ -32,6 +34,7 @@ connection_t * listensocket_accept(listensocket_t *self, listensock
const listener_t * listensocket_get_listener(listensocket_t *self); const listener_t * listensocket_get_listener(listensocket_t *self);
int listensocket_release_listener(listensocket_t *self); int listensocket_release_listener(listensocket_t *self);
listener_type_t listensocket_get_type(listensocket_t *self); listener_type_t listensocket_get_type(listensocket_t *self);
sock_family_t listensocket_get_family(listensocket_t *self);
const char * listensocket_type_to_string(listener_type_t type); const char * listensocket_type_to_string(listener_type_t type);
const char * listensocket_tlsmode_to_string(tlsmode_t mode); const char * listensocket_tlsmode_to_string(tlsmode_t mode);