Synchronize ManagerConnection socket writes to make SendAction thread safe

This commit is contained in:
Richard J Schnorenberg 2018-09-13 21:10:11 -05:00
parent 03f51ba65e
commit bc65355dda

View file

@ -45,6 +45,7 @@ namespace AsterNET.Manager
private int pingInterval = 10000; private int pingInterval = 10000;
private object lockSocket = new object(); private object lockSocket = new object();
private object lockSocketWrite = new object();
private object lockHandlers = new object(); private object lockHandlers = new object();
private bool enableEvents = true; private bool enableEvents = true;
@ -1505,9 +1506,12 @@ namespace AsterNET.Manager
private SendToAsteriskDelegate sa = null; private SendToAsteriskDelegate sa = null;
private void sendToAsterisk(string buffer) private void sendToAsterisk(string buffer)
{
lock (lockSocketWrite)
{ {
mrSocket.Write(buffer); mrSocket.Write(buffer);
} }
}
#endregion #endregion