Update parameter in CreateListenSocketP2PFakeIP calls

Changed the first parameter in the CreateListenSocketP2PFakeIP method calls from a static '0' to 'fakePortIndex'. This adjustment enables dynamic assignment of the port index based on the input, enhancing code flexibility and correctness.
This commit is contained in:
Francois 2023-11-21 19:55:27 +01:00
parent 9488b5ca6b
commit 5028bcb2be

View File

@ -318,7 +318,7 @@ public static Result GetFakeIP( int fakePortIndex, out NetAddress address )
options[0].DataType = NetConfigType.Int32; options[0].DataType = NetConfigType.Int32;
options[0].Value = NetConfig.SendBufferSize; options[0].Value = NetConfig.SendBufferSize;
options[0].Int32Value = sendBufferSize; options[0].Int32Value = sendBufferSize;
t.Socket = Internal.CreateListenSocketP2PFakeIP( 0, options.Length, options ); t.Socket = Internal.CreateListenSocketP2PFakeIP( fakePortIndex, options.Length, options );
t.Initialize(); t.Initialize();
SetSocketManager( t.Socket.Id, t ); SetSocketManager( t.Socket.Id, t );
return t; return t;
@ -335,7 +335,7 @@ public static Result GetFakeIP( int fakePortIndex, out NetAddress address )
public static SocketManager CreateRelaySocketFakeIP( int fakePortIndex, ISocketManager intrface ) public static SocketManager CreateRelaySocketFakeIP( int fakePortIndex, ISocketManager intrface )
{ {
var options = Array.Empty<NetKeyValue>(); var options = Array.Empty<NetKeyValue>();
var socket = Internal.CreateListenSocketP2PFakeIP( 0, options.Length, options ); var socket = Internal.CreateListenSocketP2PFakeIP( fakePortIndex, options.Length, options );
var t = new SocketManager var t = new SocketManager
{ {