Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions ViscaLibrary/ViscaProtocolProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static T Dequeue<T>(this BlockingCollection<T> queue)
}
#endif

public class ViscaProtocolProcessor
public class ViscaProtocolProcessor : IDisposable
{
private readonly Dictionary<ViscaCameraId, ViscaCamera> _cameras = new Dictionary<ViscaCameraId, ViscaCamera>(7);

Expand Down Expand Up @@ -118,13 +118,13 @@ public ViscaProtocolProcessor(Action<byte[]> sendData, Action<byte, string, obje
#endif
}

#if !SSHARP
~ViscaProtocolProcessor()
public void Dispose()
{
#if !SSHARP
_responseQueue.CompleteAdding();
_responseQueueCancel.Cancel(false);
}
#endif
}

/// <summary>
/// Commands in the sending queue
Expand Down Expand Up @@ -324,6 +324,11 @@ private void parseResponse(object obj)
logMessage(2, "Visca Response Queue shutdown");
break;
}
catch (InvalidOperationException)
{
logMessage(2, "Visca Response Queue shutdown 2");
break;
}
#endif
catch (Exception e)
{
Expand Down