public void Send(byte[] data, IConnection connection, IBandwidthController bandwidthController, SuccessCallback onSuccess, FailureCallback onFailure) { var buffer = new Buffer(data); SendInternal(IOState.Create(buffer, buffer.Size, connection, bandwidthController, onSuccess, onFailure)); }
internal Peer(IConnection connection) { _connection = connection; _sendSpeedWatcher = new SpeedWatcher(); _receiveSpeedWatcher = new SpeedWatcher(); _receiveBandwidthController = new UnlimitedBandwidthController(); _sendBandwidthController = new UnlimitedBandwidthController(); _statistics = new PeerStat(); _uri = new Uri("tcp://" + EndPoint.Address + ':' + EndPoint.Port); }
internal static IOState Create(BufferManager.Buffer buffer, int bytes, IConnection connection, IBandwidthController bandwidthController, SuccessCallback onSuccess, FailureCallback onFailure) { var state = Pool.Count > 0 ? Pool.Dequeue() : new IOState(); state._buffer = buffer; state._bytes = bytes; state._pendingBytes = state._bytes; state._connection = connection; state._bandwidthController = bandwidthController; state._onSuccess = onSuccess; state._onFailure = onFailure; return(state); }
public void Receive(int bytes, IConnection connection, IBandwidthController bandwidthController, SuccessCallback onSuccess, FailureCallback onFailure) { ReceiveInternal(IOState.Create(null, bytes, connection, bandwidthController, onSuccess, onFailure)); }
internal static IOState Create(BufferManager.Buffer buffer, int bytes, IConnection connection, IBandwidthController bandwidthController, SuccessCallback onSuccess, FailureCallback onFailure) { var state = Pool.Count > 0 ? Pool.Dequeue() : new IOState(); state._buffer = buffer; state._bytes = bytes; state._pendingBytes = state._bytes; state._connection = connection; state._bandwidthController = bandwidthController; state._onSuccess = onSuccess; state._onFailure = onFailure; return state; }
public ThrottledStream(Stream stream, IBandwidthController receiveBandwithController, IBandwidthController sendBandwithController) { _stream = stream; _receiveBandwithController = receiveBandwithController; _sendBandwithController = sendBandwithController; }