Some small bug fixes

This commit is contained in:
WolverinDEV
2021-03-07 21:25:55 +01:00
parent f213b199fc
commit 92a3faaed7
7 changed files with 36 additions and 12 deletions
+1 -1
Submodule rtclib updated: 06262edcdb...cdf42fccd3
+1 -1
View File
@@ -217,7 +217,7 @@ target_link_libraries(PermMapHelper
SET(CPACK_PACKAGE_VERSION_MAJOR "1")
SET(CPACK_PACKAGE_VERSION_MINOR "5")
SET(CPACK_PACKAGE_VERSION_PATCH "1")
SET(CPACK_PACKAGE_VERSION_PATCH "2")
if (BUILD_TYPE_NAME EQUAL OFF)
SET(CPACK_PACKAGE_VERSION_DATA "beta")
elseif (BUILD_TYPE_NAME STREQUAL "")
+11 -6
View File
@@ -348,7 +348,7 @@ void read_bindings(YAML::Node& root, const std::deque<std::shared_ptr<EntryBindi
inline string apply_comments(stringstream &in, map<string, deque<string>>& comments);
std::deque<std::shared_ptr<EntryBinding>> create_local_bindings(int& version, std::string& license);
#define CURRENT_CONFIG_VERSION 15
#define CURRENT_CONFIG_VERSION 16
static std::string _config_path;
vector<string> config::parseConfig(const std::string& path) {
_config_path = path;
@@ -463,6 +463,13 @@ vector<string> config::parseConfig(const std::string& path) {
nodes_key = "2";
}
}
case 15: {
auto nodes_key = resolveNode(config, "web.webrtc.stun.ip").back();
if(nodes_key.IsDefined() && nodes_key.as<std::string>() == "127.0.0.1") {
nodes_key.reset();
resolveNode(config, "web.webrtc.stun.enabled").back() = "1";
}
}
default:
break;
}
@@ -1542,16 +1549,14 @@ std::deque<std::shared_ptr<EntryBinding>> config::create_bindings() {
}
{
CREATE_BINDING("webrtc.stun.enabled", 0);
BIND_INTEGRAL(config::web::stun_enabled, false, false, true);
BIND_INTEGRAL(config::web::stun_enabled, true, false, true);
ADD_DESCRIPTION("Whatever to use a STUN server");
ADD_NOTE_RELOADABLE();
}
{
CREATE_BINDING("webrtc.stun.ip", 0);
BIND_STRING(config::web::stun_host, "127.0.0.1");
CREATE_BINDING("webrtc.stun.host", 0);
BIND_STRING(config::web::stun_host, "stun.l.google.com");
ADD_DESCRIPTION("The address of the stun server to use.");
ADD_DESCRIPTION("Attention: This must be an IP address!");
ADD_DESCRIPTION("Example whise you could use the resolved IP address of 'stun.l.google.com' as the stun server address.");
ADD_NOTE_RELOADABLE();
}
{
-2
View File
@@ -119,8 +119,6 @@ void ConnectedClient::updateChannelClientProperties(bool lock_channel_tree, bool
permission::b_client_ignore_antiflood,
permission::i_channel_view_power,
permission::b_channel_ignore_view_power,
permission::i_icon_id,
permission::b_client_is_priority_speaker,
}, channel ? channel->channelId() : 0);
permission::v2::PermissionFlaggedValue
+21
View File
@@ -79,6 +79,27 @@ uint32_t librtc_callback_rtc_configure(const void* callback_data_ptr, void* conf
options.max_port = config::web::webrtc_port_max;
std::string stun_host{config::web::stun_host};
if(!net::is_ipv4(stun_host) && !net::is_ipv6(stun_host)) {
auto timestamp_begin = std::chrono::system_clock::now();
auto result = gethostbyname(stun_host.c_str());
auto timestamp_end = std::chrono::system_clock::now();
if(!result) {
logError(target_client->getServerId(), "{} Failed to resolve stun hostname {}: {}", target_client->getLoggingPrefix(), stun_host, strerror(errno));
return 1;
}
auto addresses = (struct in_addr **) result->h_addr_list;
if(!*addresses) {
logError(target_client->getServerId(), "{} Failed to resolve stun hostname {}: Empty result", target_client->getLoggingPrefix(), stun_host);
return 1;
}
stun_host = inet_ntoa(**addresses);
logTrace(target_client->getServerId(), "{} Resolved stun host {} to {} within {}ms", target_client->getLoggingPrefix(), config::web::stun_host, stun_host,
std::chrono::duration_cast<std::chrono::milliseconds>(timestamp_end - timestamp_begin).count()
);
}
options.stun_host = stun_host.c_str();
options.stun_port = config::web::stun_port;
if(!config::web::stun_enabled) {
+1 -1
Submodule shared updated: 26981b95f7...eef0144e77