public AdjustPosition ( int offset, int length ) : void | ||
offset | int | Read position to set. |
length | int | Length from read position to set the write position. |
Результат | void |
internal uint Send(Sender sender, Message message, bool settled) { ByteBuffer buffer = new ByteBuffer(128, true); buffer.AdjustPosition(TransferFramePrefixSize, 0); // reserve space for frame header and transfer message.Encode(buffer); while (buffer.Length > 0) { this.Wait(o => ((Client)o).outWindow == 0, this, 60000); lock (this) { this.nextOutgoingId++; if (this.outWindow < uint.MaxValue) { this.outWindow--; } } int payload = this.WriteTransferFrame(sender.Handle, this.deliveryId, settled, buffer, this.maxFrameSize); Fx.DebugPrint(true, 0, "transfer", new List { this.deliveryId, settled, payload }, "delivery-id", "settled", "payload"); } return(this.deliveryId++); }
internal ByteBuffer Encode(int reservedBytes) { ByteBuffer buffer = new ByteBuffer(reservedBytes + 128, true); buffer.AdjustPosition(buffer.Offset + reservedBytes, 0); this.WriteToBuffer(buffer); return(buffer); }
internal ByteBuffer Encode(IBufferManager bufferManager, int reservedBytes) { // get some extra space to store the frame header // and the transfer command. int size = reservedBytes + this.GetEstimatedMessageSize(); ByteBuffer buffer = bufferManager.GetByteBuffer(size); buffer.AdjustPosition(buffer.Offset + reservedBytes, 0); this.WriteToBuffer(buffer); return(buffer); }
internal ByteBuffer Encode(int reservedBytes) { ByteBuffer buffer = new ByteBuffer(reservedBytes + 128, true); buffer.AdjustPosition(buffer.Offset + reservedBytes, 0); this.WriteToBuffer(buffer); return buffer; }
internal uint Send(Sender sender, Message message, bool settled) { ByteBuffer buffer = new ByteBuffer(128, true); buffer.AdjustPosition(TransferFramePrefixSize, 0); // reserve space for frame header and transfer message.Encode(buffer); while (buffer.Length > 0) { this.Wait(o => ((Client)o).outWindow == 0, this, 60000); lock (this) { this.nextOutgoingId++; if (this.outWindow < uint.MaxValue) { this.outWindow--; } } int payload = this.WriteTransferFrame(sender.Handle, this.deliveryId, settled, buffer, this.maxFrameSize); Fx.DebugPrint(true, 0, "transfer", new List { this.deliveryId, settled, payload }, "delivery-id", "settled", "payload"); } return this.deliveryId++; }