Respect the packet's type

One of the overloaded Send methods for the client and the server now
accepts the generic parameter.
This commit is contained in:
yankejustin 2015-05-18 20:43:15 -04:00
parent d20dcc3fed
commit 6c12e0b7ec
2 changed files with 4 additions and 4 deletions

View File

@ -255,7 +255,7 @@ private void AsyncReceive(IAsyncResult result)
}
}
public void Send<T>(IPacket packet) where T : IPacket
public void Send<T>(T packet) where T : IPacket
{
lock (_handle)
{
@ -266,7 +266,7 @@ private void AsyncReceive(IAsyncResult result)
{
using (MemoryStream ms = new MemoryStream())
{
Serializer.SerializeWithLengthPrefix<T>(ms, (T) packet, PrefixStyle.Fixed32);
Serializer.SerializeWithLengthPrefix<T>(ms, packet, PrefixStyle.Fixed32);
byte[] data = ms.ToArray();

View File

@ -237,7 +237,7 @@ private void AsyncReceive(IAsyncResult result)
}
}
public void Send<T>(IPacket packet) where T : IPacket
public void Send<T>(T packet) where T : IPacket
{
lock (_handle)
{
@ -248,7 +248,7 @@ private void AsyncReceive(IAsyncResult result)
{
using (MemoryStream ms = new MemoryStream())
{
Serializer.SerializeWithLengthPrefix<T>(ms, (T) packet, PrefixStyle.Fixed32);
Serializer.SerializeWithLengthPrefix<T>(ms, packet, PrefixStyle.Fixed32);
byte[] data = ms.ToArray();