mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Cover closing remote connection when socket is disposed.
This commit is contained in:
3
.idea/.idea.Aaru/.idea/contentModel.xml
generated
3
.idea/.idea.Aaru/.idea/contentModel.xml
generated
@@ -3,8 +3,7 @@
|
||||
<component name="ContentModelStore">
|
||||
<e p="$USER_HOME$/.cache/JetBrains/Rider2020.2/extResources" t="IncludeRecursive" />
|
||||
<e p="$USER_HOME$/.cache/JetBrains/Rider2020.2/resharper-host/local/Transient/Rider/v202/SolutionCaches/_Aaru.232757112.00" t="ExcludeRecursive" />
|
||||
<e p="$APPLICATION_CONFIG_DIR$/consoles/db" t="IncludeRecursive" />
|
||||
<e p="$APPLICATION_CONFIG_DIR$/extensions" t="IncludeRecursive" />
|
||||
<e p="$USER_HOME$/.config/git/ignore" t="IncludeRecursive" />
|
||||
<e p="$APPLICATION_PLUGINS_DIR$/puppet/lib/stubs" t="IncludeRecursive" />
|
||||
<e p="$USER_HOME$/.nuget/packages/microsoft.net.test.sdk/16.4.0/build/netcoreapp2.1" t="Include">
|
||||
<e p="Microsoft.NET.Test.Sdk.Program.cs" t="Include" />
|
||||
|
||||
2
.idea/.idea.Aaru/riderModule.iml
generated
2
.idea/.idea.Aaru/riderModule.iml
generated
@@ -8,7 +8,5 @@
|
||||
<content url="file://$USER_HOME$/.nuget/packages/nunit3testadapter/3.15.1/build/netcoreapp2.0/nunit.engine.dll" />
|
||||
<content url="file://$MODULE_DIR$/../.." />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="R User Library" level="project" />
|
||||
<orderEntry type="library" name="R Skeletons" level="application" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -260,10 +260,17 @@ namespace Aaru.Devices.Remote
|
||||
public void Dispose() => Disconnect();
|
||||
|
||||
public void Disconnect()
|
||||
{
|
||||
try
|
||||
{
|
||||
_socket.Shutdown(SocketShutdown.Both);
|
||||
_socket.Close();
|
||||
}
|
||||
catch(ObjectDisposedException)
|
||||
{
|
||||
// Ignore if already disposed
|
||||
}
|
||||
}
|
||||
|
||||
public DeviceInfo[] ListDevices()
|
||||
{
|
||||
@@ -1415,7 +1422,14 @@ namespace Aaru.Devices.Remote
|
||||
|
||||
byte[] buf = Marshal.StructureToByteArrayLittleEndian(cmdPkt);
|
||||
|
||||
try
|
||||
{
|
||||
_socket.Send(buf, SocketFlags.None);
|
||||
}
|
||||
catch(ObjectDisposedException)
|
||||
{
|
||||
// Ignore if already disposed
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user