public void finishRead(IceInternal.Buffer buf) { _configuration.checkReadException(); if (_buffered) { if (buf.b.hasRemaining()) { _transceiver.finishRead(_readBuffer); int pos = _readBuffer.b.position(); int requested = buf.b.remaining(); int available = pos - _readBufferPos; if (available > 0) { if (available >= requested) { available = requested; } byte[] arr = new byte[available]; _readBuffer.b.position(_readBufferPos); _readBuffer.b.get(arr); buf.b.put(arr); _readBufferPos += available; _readBuffer.b.position(pos); } } } else { _transceiver.finishRead(buf); } }
public bool startRead(IceInternal.Buffer buf, IceInternal.AsyncCallback callback, object state) { if (_configuration.readReady()) { _configuration.checkReadException(); // Only raise if we're configured to read now. } return(_transceiver.startRead(buf, callback, state)); }
public int write(IceInternal.Buffer buf) { if (!_configuration.writeReady() && buf.b.hasRemaining()) { return(IceInternal.SocketOperation.Write); } _configuration.checkWriteException(); return(_transceiver.write(buf)); }
// // Only for use by Connector, Acceptor // internal Transceiver(IceInternal.Transceiver transceiver) { _transceiver = transceiver; _configuration = Configuration.getInstance(); _initialized = false; _readBuffer = new IceInternal.Buffer(); _readBuffer.resize(1024 * 8, true); // 8KB buffer _readBuffer.b.position(0); _readBufferPos = 0; _buffered = _configuration.buffered(); }
public Buffer(Buffer buf, bool adopt) { b = buf.b; _size = buf._size; _capacity = buf._capacity; _shrinkCounter = buf._shrinkCounter; _order = buf._order; if(adopt) { buf.clear(); } }
public int read(IceInternal.Buffer buf, ref bool hasMoreData) { if (!_configuration.readReady() && buf.b.hasRemaining()) { return(IceInternal.SocketOperation.Read); } _configuration.checkReadException(); if (_buffered) { while (buf.b.hasRemaining()) { if (_readBufferPos == _readBuffer.b.position()) { _readBufferPos = 0; _readBuffer.b.position(0); _transceiver.read(_readBuffer, ref hasMoreData); if (_readBufferPos == _readBuffer.b.position()) { hasMoreData = false; return(IceInternal.SocketOperation.Read); } } int pos = _readBuffer.b.position(); Debug.Assert(pos > _readBufferPos); int requested = buf.b.remaining(); int available = pos - _readBufferPos; Debug.Assert(available > 0); if (available >= requested) { available = requested; } byte[] arr = new byte[available]; _readBuffer.b.position(_readBufferPos); _readBuffer.b.get(arr); buf.b.put(arr); _readBufferPos += available; _readBuffer.b.position(pos); } hasMoreData = _readBufferPos < _readBuffer.b.position(); return(IceInternal.SocketOperation.None); } else { return(_transceiver.read(buf, ref hasMoreData)); } }
public int initialize(IceInternal.Buffer readBuffer, IceInternal.Buffer writeBuffer, ref bool hasMoreData) { _configuration.checkInitializeException(); if (!_initialized) { int status = _transceiver.initialize(readBuffer, writeBuffer, ref hasMoreData); if (status != IceInternal.SocketOperation.None) { return(status); } _initialized = true; } return(IceInternal.SocketOperation.None); }
public bool read(IceInternal.Buffer buf) { if (!_initialized) { throw new Ice.SocketException(); } if (!_configuration.readReady()) { return(false); } _configuration.checkReadException(); return(_transceiver.read(buf)); }
public bool startRead(IceInternal.Buffer buf, IceInternal.AsyncCallback callback, object state) { if (_configuration.readReady()) { _configuration.checkReadException(); // Only raise if we're configured to read now. } if (_buffered) { int pos = _readBuffer.b.position(); int available = pos - _readBufferPos; if (available > 0) { int requested = buf.b.remaining(); if (available >= requested) { available = requested; } byte[] arr = new byte[available]; _readBuffer.b.position(_readBufferPos); _readBuffer.b.get(arr); buf.b.put(arr); _readBufferPos += available; _readBuffer.b.position(pos); } if (_readBufferPos == _readBuffer.b.position() && buf.b.hasRemaining()) { _readBufferPos = 0; _readBuffer.b.position(0); return(_transceiver.startRead(_readBuffer, callback, state)); } else { Debug.Assert(!buf.b.hasRemaining()); return(true); // Completed synchronously } } else { return(_transceiver.startRead(buf, callback, state)); } }
public int endWrite(Buffer buf) { // Once the request is sent, read the response return(buf.b.hasRemaining() ? SocketOperation.Write : SocketOperation.Read); }
public void checkSendSize(Buffer buf) { }
public void checkSendSize(IceInternal.Buffer buf) { _transceiver.checkSendSize(buf); }
public int read(Buffer buf, ref bool hasMoreData) { return _stream.read(buf); }
public void finishWrite(IceInternal.Buffer buf) { _configuration.checkWriteException(); _transceiver.finishWrite(buf); }
public void finishWrite(Buffer buf) { _stream.finishWrite(buf); }
public bool startRead(Buffer buf, AsyncCallback callback, object state) { return _stream.startRead(buf, callback, state); }
public bool startWrite(IceInternal.Buffer buf, IceInternal.AsyncCallback callback, object state, out bool completed) { _configuration.checkWriteException(); return(_transceiver.startWrite(buf, callback, state, out completed)); }
public bool startWrite(Buffer buf, AsyncCallback callback, object state, out bool completed) { return _stream.startWrite(buf, callback, state, out completed); }
public void finishRead(Buffer buf) { _stream.finishRead(buf); }
public void finishRead(IceInternal.Buffer buf) { _configuration.checkReadException(); _transceiver.finishRead(buf); }
public int write(Buffer buf) { return _stream.write(buf); }
public int endRead(Buffer buf) { // We're done once we read the response return(buf.b.hasRemaining() ? SocketOperation.Read : SocketOperation.None); }
public void checkSendSize(IceInternal.Buffer buf, int messageSizeMax) { _transceiver.checkSendSize(buf, messageSizeMax); }
public int initialize(Buffer readBuffer, Buffer writeBuffer, ref bool hasMoreData) { return _stream.connect(readBuffer, writeBuffer, ref hasMoreData); }