mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2025-05-06 11:32:59 +00:00
sendLock
This commit is contained in:
parent
61a1683c26
commit
eca142b37b
@ -298,13 +298,12 @@ namespace Esyur.Net.HTTP
|
||||
if (n <= 0)
|
||||
break;
|
||||
|
||||
Thread.Sleep(50);
|
||||
//Thread.Sleep(50);
|
||||
base.Send(buffer, 0, n);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@ -55,6 +55,8 @@ namespace Esyur.Net
|
||||
public event DestroyedEvent OnDestroy;
|
||||
object receivingLock = new object();
|
||||
|
||||
object sendLock = new object();
|
||||
|
||||
bool processing = false;
|
||||
|
||||
|
||||
@ -260,33 +262,39 @@ namespace Esyur.Net
|
||||
|
||||
public virtual void Send(byte[] msg)
|
||||
{
|
||||
try
|
||||
lock (sendLock)
|
||||
{
|
||||
if (sock != null)
|
||||
try
|
||||
{
|
||||
lastAction = DateTime.Now;
|
||||
sock.Send(msg);
|
||||
if (sock != null)
|
||||
{
|
||||
lastAction = DateTime.Now;
|
||||
sock.Send(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Send(byte[] msg, int offset, int length)
|
||||
{
|
||||
try
|
||||
lock (sendLock)
|
||||
{
|
||||
if (sock != null)
|
||||
try
|
||||
{
|
||||
lastAction = DateTime.Now;
|
||||
sock.Send(msg, offset, length);
|
||||
if (sock != null)
|
||||
{
|
||||
lastAction = DateTime.Now;
|
||||
sock.Send(msg, offset, length);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user