We should be passing the port numbers around as unsigned. Oops.

This commit is contained in:
casey langen 2020-11-13 18:50:45 -08:00
parent bc96d35bb2
commit f9f4557402
6 changed files with 14 additions and 8 deletions

View File

@ -5,6 +5,8 @@
box will have a blue (instead of red) border. box will have a blue (instead of red) border.
* relaxed search to ignore accents. for example: 'À', 'Á`, 'Â`, etc are all * relaxed search to ignore accents. for example: 'À', 'Á`, 'Â`, etc are all
considered equivalent to the english 'A', and vice versa. considered equivalent to the english 'A', and vice versa.
* fixed a bug where remote library ports greater than 32767 caused the app to
crash.
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

View File

@ -428,7 +428,7 @@ std::string RemoteLibrary::GetTrackUri(musik::core::sdk::ITrack* track, const st
auto prefs = Preferences::ForComponent(core::prefs::components::Settings); auto prefs = Preferences::ForComponent(core::prefs::components::Settings);
auto host = prefs->GetString(core::prefs::keys::RemoteLibraryHostname, "127.0.0.1"); auto host = prefs->GetString(core::prefs::keys::RemoteLibraryHostname, "127.0.0.1");
auto port = (short) prefs->GetInt(core::prefs::keys::RemoteLibraryHttpPort, 7905); auto port = (unsigned short) prefs->GetInt(core::prefs::keys::RemoteLibraryHttpPort, 7905);
auto password = prefs->GetString(core::prefs::keys::RemoteLibraryPassword, ""); auto password = prefs->GetString(core::prefs::keys::RemoteLibraryPassword, "");
auto useTls = prefs->GetBool(core::prefs::keys::RemoteLibraryHttpTls, false); auto useTls = prefs->GetBool(core::prefs::keys::RemoteLibraryHttpTls, false);
@ -464,7 +464,7 @@ const net::WebSocketClient& RemoteLibrary::WebSocketClient() const {
void RemoteLibrary::ReloadConnectionFromPreferences() { void RemoteLibrary::ReloadConnectionFromPreferences() {
auto prefs = Preferences::ForComponent(core::prefs::components::Settings); auto prefs = Preferences::ForComponent(core::prefs::components::Settings);
auto host = prefs->GetString(core::prefs::keys::RemoteLibraryHostname, "127.0.0.1"); auto host = prefs->GetString(core::prefs::keys::RemoteLibraryHostname, "127.0.0.1");
auto port = (short) prefs->GetInt(core::prefs::keys::RemoteLibraryWssPort, 7905); auto port = (unsigned short) prefs->GetInt(core::prefs::keys::RemoteLibraryWssPort, 7905);
auto password = prefs->GetString(core::prefs::keys::RemoteLibraryPassword, ""); auto password = prefs->GetString(core::prefs::keys::RemoteLibraryPassword, "");
auto useTls = prefs->GetBool(core::prefs::keys::RemoteLibraryWssTls, false); auto useTls = prefs->GetBool(core::prefs::keys::RemoteLibraryWssTls, false);
this->wsc.Connect(host, port, password, useTls); this->wsc.Connect(host, port, password, useTls);

View File

@ -124,11 +124,15 @@ void RawWebSocketClient::Connect(const std::string& uri) {
websocketpp::lib::error_code ec; websocketpp::lib::error_code ec;
if (mode == Mode::PlainText) { if (mode == Mode::PlainText) {
PlainTextClient::connection_ptr connection = plainTextClient->get_connection(uri, ec); PlainTextClient::connection_ptr connection = plainTextClient->get_connection(uri, ec);
plainTextClient->connect(connection); if (!ec) {
plainTextClient->connect(connection);
}
} }
else if (mode == Mode::TLS) { else if (mode == Mode::TLS) {
TlsClient::connection_ptr connection = tlsClient->get_connection(uri, ec); TlsClient::connection_ptr connection = tlsClient->get_connection(uri, ec);
tlsClient->connect(connection); if (!ec) {
tlsClient->connect(connection);
}
} }
} }

View File

@ -230,7 +230,7 @@ std::string WebSocketClient::EnqueueQuery(Query query) {
void WebSocketClient::Connect( void WebSocketClient::Connect(
const std::string& host, const std::string& host,
short port, unsigned short port,
const std::string& password, const std::string& password,
bool useTls) bool useTls)
{ {

View File

@ -95,7 +95,7 @@ namespace musik { namespace core { namespace net {
void Connect( void Connect(
const std::string& host, const std::string& host,
short port, unsigned short port,
const std::string& password, const std::string& password,
bool useTls); bool useTls);

View File

@ -195,8 +195,8 @@ void RemoteLibrarySettingsLayout::LoadPreferences() {
this->httpTlsCheckbox->CheckChanged.disconnect(this); this->httpTlsCheckbox->CheckChanged.disconnect(this);
auto host = prefs->GetString(core::prefs::keys::RemoteLibraryHostname, "127.0.0.1"); auto host = prefs->GetString(core::prefs::keys::RemoteLibraryHostname, "127.0.0.1");
auto const wssPort = (short) prefs->GetInt(core::prefs::keys::RemoteLibraryWssPort, 7905); auto const wssPort = (unsigned short) prefs->GetInt(core::prefs::keys::RemoteLibraryWssPort, 7905);
auto const httpPort = (short) prefs->GetInt(core::prefs::keys::RemoteLibraryHttpPort, 7906); auto const httpPort = (unsigned short) prefs->GetInt(core::prefs::keys::RemoteLibraryHttpPort, 7906);
auto const password = prefs->GetString(core::prefs::keys::RemoteLibraryPassword, ""); auto const password = prefs->GetString(core::prefs::keys::RemoteLibraryPassword, "");
auto const wssTls = prefs->GetBool(core::prefs::keys::RemoteLibraryWssTls, false); auto const wssTls = prefs->GetBool(core::prefs::keys::RemoteLibraryWssTls, false);
auto const httpTls = prefs->GetBool(core::prefs::keys::RemoteLibraryHttpTls, false); auto const httpTls = prefs->GetBool(core::prefs::keys::RemoteLibraryHttpTls, false);