Example #1
0
        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));
        }
Example #2
0
 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);
 }
Example #3
0
 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);
 }
Example #4
0
        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);
        }
Example #5
0
 public void Receive(int bytes, IConnection connection, IBandwidthController bandwidthController,
                     SuccessCallback onSuccess, FailureCallback onFailure)
 {
     ReceiveInternal(IOState.Create(null, bytes, connection, bandwidthController, onSuccess, onFailure));
 }
 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));
 }
 public void Receive(int bytes, IConnection connection, IBandwidthController bandwidthController,
                            SuccessCallback onSuccess, FailureCallback onFailure)
 {
     ReceiveInternal(IOState.Create(null, bytes, connection, bandwidthController, onSuccess, onFailure));
 }
Example #8
0
        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;
        }
Example #9
0
 public ThrottledStream(Stream stream, IBandwidthController receiveBandwithController, IBandwidthController sendBandwithController)
 {
     _stream = stream;
     _receiveBandwithController = receiveBandwithController;
     _sendBandwithController    = sendBandwithController;
 }
Example #10
0
 public ThrottledStream(Stream stream, IBandwidthController receiveBandwithController, IBandwidthController sendBandwithController)
 {
     _stream = stream;
     _receiveBandwithController = receiveBandwithController;
     _sendBandwithController = sendBandwithController;
 }