This commit is contained in:
vis2k 2022-12-03 18:52:13 -05:00
parent 33a697896c
commit 0dfd4e15cc

View File

@ -135,12 +135,16 @@ public override void ClientSend(ArraySegment<byte> segment, int channelId)
// transport 0 will produce connection ids [0, 3, 6, 9, ...]
// transport 1 will produce connection ids [1, 4, 7, 10, ...]
// transport 2 will produce connection ids [2, 5, 8, 11, ...]
// convert transport relative connId to multiplexed connId
public static int FromBaseId(int transportId, int connectionId, int transportAmount) =>
connectionId * transportAmount + transportId;
// convert multiplexed connectionId back to transport relative connId
public static int ToBaseId(int connectionId, int transportAmount) =>
connectionId / transportAmount;
// convert multiplexed connectionid back to transport id
public static int ToTransportId(int connectionId, int transportAmount) =>
connectionId % transportAmount;