The Connect method of Client.cs creates a new Semaphore (cs) each time it is called. It should only create a new Semaphore if cs is null.
Existing Client.cs code:
cs = new Semaphore(1, 1);
Proposed change:
if (null == cs) { cs = new Semaphore(1, 1); }
If a second call to Connect is made, concurrent method calls using cs for synchronization can have their cs Semaphore changed to a new instance. This probably only triggers on poorly written code.
The Connect method of Client.cs creates a new Semaphore (cs) each time it is called. It should only create a new Semaphore if cs is null.
Existing Client.cs code:
cs = new Semaphore(1, 1);
Proposed change:
if (null == cs) { cs = new Semaphore(1, 1); }
If a second call to Connect is made, concurrent method calls using cs for synchronization can have their cs Semaphore changed to a new instance. This probably only triggers on poorly written code.