Skip to content

Commit 1bdb5e9

Browse files
blackspherefollowerqdot
authored andcommitted
Fixing a few bugs
1. The images were missing from the about page 2. The Stop button shutdown the WS server, but left exisiting connections open 3. All interfaces were listed even in loopback only mode
1 parent dcc8b0a commit 1bdb5e9

3 files changed

Lines changed: 17 additions & 10 deletions

File tree

Buttplug.Apps.WebsocketServerGUI/WebsocketServerControl.xaml.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,17 @@ public void StartServer()
102102
_connUrls.Clear();
103103
_connUrls.Add(new ConnUrlData(_secure, "localhost", _port));
104104

105-
foreach (var network in NetworkInterface.GetAllNetworkInterfaces())
105+
if (!_loopback)
106106
{
107-
foreach (IPAddressInformation address in network.GetIPProperties().UnicastAddresses)
107+
foreach (var network in NetworkInterface.GetAllNetworkInterfaces())
108108
{
109-
if (address.Address.AddressFamily == AddressFamily.InterNetwork && !IPAddress.IsLoopback(address.Address))
109+
foreach (IPAddressInformation address in network.GetIPProperties().UnicastAddresses)
110110
{
111-
_connUrls.Add(new ConnUrlData(_secure, address.Address.ToString(), _port));
111+
if (address.Address.AddressFamily == AddressFamily.InterNetwork &&
112+
!IPAddress.IsLoopback(address.Address))
113+
{
114+
_connUrls.Add(new ConnUrlData(_secure, address.Address.ToString(), _port));
115+
}
112116
}
113117
}
114118
}

Buttplug.Components.Controls/ButtplugAboutControl.xaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
mc:Ignorable="d"
77
d:DesignHeight="300" d:DesignWidth="525">
88
<Grid Background="#FFE5E5E5">
9-
<Image Name="IconImage" Source="pack://application:,,,/ButtplugControlLibrary;component/Resources/buttplug-logo-1.png" HorizontalAlignment="Left" Height="128" Margin="10,10,0,0" VerticalAlignment="Top" Width="128" MouseDown="IconImage_Click">
10-
</Image>
11-
<TextBlock HorizontalAlignment="Left" Margin="143,10,0,0" VerticalAlignment="Top" Height="128" Width="360">
9+
<Image Name="IconImage" Source="pack://application:,,,/Buttplug.Components.Controls;component/Resources/buttplug-logo-1.png" HorizontalAlignment="Left" Height="128" Margin="10,10,0,0" VerticalAlignment="Top" Width="128" MouseDown="IconImage_Click"/>
10+
<TextBlock HorizontalAlignment="Left" Margin="143,10,0,0" VerticalAlignment="Top" Height="128" Width="360">
1211
<Span FontSize="19" FontWeight="Bold">Buttplug <Run Name="AboutVersionNumber">1.0.0.0-ffffffff</Run> (C# Edition)</Span><LineBreak />
1312
By <Hyperlink NavigateUri="https://metafetish.com" RequestNavigate="Hyperlink_RequestNavigate">Metafetish</Hyperlink><LineBreak />
1413
<LineBreak/>
@@ -22,6 +21,6 @@
2221
If you would like to help sponsor further development of this and other adult toy and interface software,
2322
please consider donating to our patreon campaign at <Hyperlink NavigateUri="https://patreon.com/qdot" RequestNavigate="Hyperlink_RequestNavigate">http://patreon.com/qdot</Hyperlink>, or by clicking on the Patreon image below. Thanks, and enjoy buttpluging!
2423
</TextBlock>
25-
<Image Source="pack://application:,,,/ButtplugControlLibrary;component/Resources/buttplugin-with-qdot-intro-patreon-image.png" HorizontalAlignment="Center" VerticalAlignment="Bottom" Width="116" Height="65" Margin="0,10,0,10" MouseDown="PatreonRequestNavigate" />
24+
<Image Source="pack://application:,,,/Buttplug.Components.Controls;component/Resources/buttplugin-with-qdot-intro-patreon-image.png" HorizontalAlignment="Center" VerticalAlignment="Bottom" Width="116" Height="65" Margin="0,10,0,10" MouseDown="PatreonRequestNavigate" />
2625
</Grid>
2726
</UserControl>

Buttplug.Components.WebsocketServer/ButtplugWebsocketServer.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,12 @@ public class ButtplugWebsocketServer
4141
[NotNull]
4242
private ConcurrentDictionary<string, WebSocket> _connections = new ConcurrentDictionary<string, WebSocket>();
4343

44+
[NotNull]
45+
private CancellationTokenSource _cancellation;
46+
4447
public void StartServer([NotNull] IButtplugServerFactory aFactory, int aPort = 12345, bool aLoopBack = true, bool aSecure = false, string aHostname = "localhost")
4548
{
46-
CancellationTokenSource cancellation = new CancellationTokenSource();
49+
_cancellation = new CancellationTokenSource();
4750
_factory = aFactory;
4851

4952
_logManager = new ButtplugLogManager();
@@ -61,7 +64,7 @@ public void StartServer([NotNull] IButtplugServerFactory aFactory, int aPort = 1
6164

6265
_server.Start();
6366

64-
Task.Run(() => AcceptWebSocketClientsAsync(_server, cancellation.Token));
67+
Task.Run(() => AcceptWebSocketClientsAsync(_server, _cancellation.Token));
6568
}
6669

6770
private async Task AcceptWebSocketClientsAsync(WebSocketListener aServer, CancellationToken aToken)
@@ -191,6 +194,7 @@ private async Task HandleConnectionAsync(WebSocket ws, CancellationToken cancell
191194
public void StopServer()
192195
{
193196
_server?.Stop();
197+
_cancellation.Cancel();
194198
}
195199

196200
public void Disconnect(string remoteId = null)

0 commit comments

Comments
 (0)