Added TShock.SendBytes which uses packetbuffer if available, otherwise sends like normal.
This commit is contained in:
parent
2ed91e26a0
commit
258b7d48fb
4 changed files with 44 additions and 19 deletions
|
|
@ -123,9 +123,13 @@ namespace TShockAPI
|
|||
buffers[socket.whoAmI] = new PacketBuffer();
|
||||
}
|
||||
|
||||
void ServerHooks_SendBytes(ServerSock socket, byte[] buffer, int offset, int count, HandledEventArgs e)
|
||||
public void SendBytes(ServerSock socket, byte[] buffer)
|
||||
{
|
||||
SendBytes(socket, buffer, 0, buffer.Length);
|
||||
}
|
||||
|
||||
public void SendBytes(ServerSock socket, byte[] buffer, int offset, int count)
|
||||
{
|
||||
e.Handled = true;
|
||||
lock (buffers[socket.whoAmI])
|
||||
{
|
||||
#if DEBUG_NET
|
||||
|
|
@ -142,6 +146,12 @@ namespace TShockAPI
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ServerHooks_SendBytes(ServerSock socket, byte[] buffer, int offset, int count, HandledEventArgs e)
|
||||
{
|
||||
e.Handled = true;
|
||||
SendBytes(socket, buffer, offset, count);
|
||||
}
|
||||
#if DEBUG_NET
|
||||
static int Compress(byte[] buffer, int offset, int count)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue