public byte[] Encode(SubtConnectedPeerStream connectedStream) { var ms = new MemoryStream(); using (var writer = new BinaryWriter(ms)) { ExtensionProcedures.InitializeExtensionSignalingPacket(writer, connectedStream.SubtLocalPeer.LocalPeer.LocalPeerId, connectedStream.SubtConnectedPeer.RemotePeerId, connectedStream.StreamId, connectedStream.SubtLocalPeer.ExtensionId); writer.Write((byte)SubtPacketType.RemoteStatus); writer.Write(RecentRxBandwidth); writer.Write(RecentRxPacketLoss); writer.Write(RecentTxBandwidth); byte flags = 0; if (IwantToIncreaseBandwidthUntilHighPacketLoss) { flags |= 0x01; } if (IhavePassiveRole) { flags |= 0x02; } writer.Write(flags); } return(ms.ToArray()); }
public byte[] Encode(SubtConnectedPeerStream connectedStream) { PacketProcedures.CreateBinaryWriter(out var ms, out var writer); ExtensionProcedures.InitializeExtensionSignalingPacket(writer, connectedStream.SubtLocalPeer.LocalPeer.LocalPeerId, connectedStream.SubtConnectedPeer.RemotePeerId, connectedStream.StreamId, connectedStream.SubtLocalPeer.ExtensionId); writer.Write((byte)SubtPacketType.AdjustmentResponse); byte flags = 0; // not used now writer.Write(flags); writer.Write(TxTargetBandwidth); return(ms.ToArray()); }
public byte[] Encode(SubtConnectedPeerStream connectedStream) { PacketProcedures.CreateBinaryWriter(out var ms, out var writer); ExtensionProcedures.InitializeExtensionSignalingPacket(writer, connectedStream.SubtLocalPeer.LocalPeer.LocalPeerId, connectedStream.SubtConnectedPeer.RemotePeerId, connectedStream.StreamId, connectedStream.SubtLocalPeer.ExtensionId); writer.Write((byte)SubtPacketType.RemoteStatus); writer.Write(RecentRxBandwidth); writer.Write(RecentRxPacketLoss); writer.Write(RecentTxBandwidth); byte flags = 0; if (IhavePassiveRole) { flags |= 0x02; } if (ImHealthyAndReadyFor100kbpsU2uSymbiosis) { flags |= 0x04; } writer.Write(flags); return(ms.ToArray()); }