Fixed pointer size in ConnectionInterface

This commit is contained in:
Garry Newman 2019-06-25 13:01:41 +01:00
parent 39bc7b5c1b
commit caea5ccb9b
2 changed files with 4 additions and 8 deletions

View File

@ -72,9 +72,8 @@ public virtual void OnDisconnected( ConnectionInfo data )
public void Receive( int bufferSize = 32 ) public void Receive( int bufferSize = 32 )
{ {
// #32bit
int processed = 0; int processed = 0;
IntPtr messageBuffer = Marshal.AllocHGlobal( 8 * bufferSize ); IntPtr messageBuffer = Marshal.AllocHGlobal( IntPtr.Size * bufferSize );
try try
{ {
@ -82,8 +81,7 @@ public void Receive( int bufferSize = 32 )
for ( int i = 0; i < processed; i++ ) for ( int i = 0; i < processed; i++ )
{ {
// #32bit ReceiveMessage( Marshal.ReadIntPtr( messageBuffer, i * IntPtr.Size ) );
ReceiveMessage( Marshal.ReadIntPtr( messageBuffer, i * 8) );
} }
} }
finally finally

View File

@ -64,9 +64,8 @@ public virtual void OnDisconnected( Connection connection, ConnectionInfo data )
public void Receive( int bufferSize = 32 ) public void Receive( int bufferSize = 32 )
{ {
// #32bit
int processed = 0; int processed = 0;
IntPtr messageBuffer = Marshal.AllocHGlobal( 8 * bufferSize ); IntPtr messageBuffer = Marshal.AllocHGlobal( IntPtr.Size * bufferSize );
try try
{ {
@ -74,8 +73,7 @@ public void Receive( int bufferSize = 32 )
for ( int i = 0; i < processed; i++ ) for ( int i = 0; i < processed; i++ )
{ {
// #32bit ReceiveMessage( Marshal.ReadIntPtr( messageBuffer, i * IntPtr.Size ) );
ReceiveMessage( Marshal.ReadIntPtr( messageBuffer, i * 8 ) );
} }
} }
finally finally