aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Application/Service.cs
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-06-24 09:42:34 -0500
committerGitHub <noreply@github.com>2021-06-24 09:42:34 -0500
commitd0ae5db8e0ebb989c6470c3b8f1c1793dafb1d8f (patch)
treebe15aee66b361efe6e6d2c97db59236be4c0202f /src/slskd/Application/Service.cs
parent73f5c8a5cbe56745156d24b6c744cbe24567c23f (diff)
parent7383d448e7481ca5dc046b8118e5709ab571b69f (diff)
downloadslskd-d0ae5db8e0ebb989c6470c3b8f1c1793dafb1d8f.tar.gz
Merge pull request #102 from slskd/connections
Add the ability to connect and disconnect the client from the API/UI
Diffstat (limited to 'src/slskd/Application/Service.cs')
-rw-r--r--src/slskd/Application/Service.cs16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/slskd/Application/Service.cs b/src/slskd/Application/Service.cs
index 246e7fc6..60fae0cc 100644
--- a/src/slskd/Application/Service.cs
+++ b/src/slskd/Application/Service.cs
@@ -121,6 +121,7 @@ namespace slskd
Client.RoomLeft += Client_RoomLeft;
Client.Disconnected += Client_Disconnected;
Client.Connected += Client_Connected;
+ Client.LoggedIn += Client_LoggedIn;
SoulseekClient = Client;
@@ -207,14 +208,23 @@ namespace slskd
private void Client_Connected(object sender, EventArgs e)
{
- Logger.Information("Connected and logged in as {Username}", Options.Soulseek.Username);
+ Logger.Information("Connected to the Soulseek server");
+ }
+
+ private void Client_LoggedIn(object sender, EventArgs e)
+ {
+ Logger.Information("Logged in to the Soulseek server as {Username}", Options.Soulseek.Username);
}
private async void Client_Disconnected(object sender, SoulseekClientDisconnectedEventArgs args)
{
if (args.Exception is ObjectDisposedException || args.Exception is ApplicationShutdownException)
{
- Logger.Debug("Disconnected from the Soulseek server: the client is shutting down");
+ Logger.Information("Disconnected from the Soulseek server: the client is shutting down");
+ }
+ else if (args.Exception is IntentionalDisconnectException)
+ {
+ Logger.Information("Disconnected from the Soulseek server: disconnected by the user");
}
else if (args.Exception is LoginRejectedException)
{
@@ -226,7 +236,7 @@ namespace slskd
}
else
{
- Logger.Error("Disconnected from the Soulseek server: {Message}", args.Exception.Message);
+ Logger.Error("Disconnected from the Soulseek server: {Message}", args.Exception?.Message ?? args.Message);
var attempts = 1;