Skip to content

Commit

Permalink
CHRON-22 Add support for remote client access
Browse files Browse the repository at this point in the history
  • Loading branch information
lburgazzoli committed Jan 14, 2015
1 parent 8ee4ea6 commit c0ef565
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
Expand Up @@ -422,7 +422,7 @@ public boolean nextIndex() {
throw new StreamCorruptedException("Size was " + receivedSize);
}

if(receivedSize > capacity()) {
if(receivedSize > this.readBuffer.capacity()) {
ChronicleTcp.clean(this.readBuffer);

this.readBuffer = ChronicleTcp.createBuffer(Maths.nextPower2(receivedSize, receivedSize));
Expand Down
Expand Up @@ -296,11 +296,7 @@ protected void setLastHeartbeat(long from) {
}

protected void sendSizeAndIndex(int size, long index) throws IOException {
writeBuffer.clear();
writeBuffer.putInt(size);
writeBuffer.putLong(index);
writeBuffer.flip();
connection.writeAllOrEOF(writeBuffer);
connection.writeSizeAndIndex(writeBuffer, size, index);
setLastHeartbeat();
}

Expand Down
Expand Up @@ -141,6 +141,15 @@ public void readUpTo(ByteBuffer buffer, int size) throws IOException {
buffer.flip();
}

public void writeSizeAndIndex(ByteBuffer buffer, int action, long index) throws IOException {
buffer.clear();
buffer.putInt(action);
buffer.putLong(index);
buffer.flip();

writeAllOrEOF(buffer);
}

public void writeAction(ByteBuffer buffer, long action, long index) throws IOException {
buffer.clear();
buffer.putLong(action);
Expand Down

0 comments on commit c0ef565

Please sign in to comment.