mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-07 14:54:15 +00:00
Use direct byte buffers instead of normal ones in niowrapper
This commit is contained in:
parent
e6965d0217
commit
2061d28e52
@ -53,7 +53,7 @@ public class ProtobufClient extends MessageWriteTarget {
|
||||
final int connectTimeoutMillis) throws IOException {
|
||||
// Try to fit at least one message in the network buffer, but place an upper and lower limit on its size to make
|
||||
// sure it doesnt get too large or have to call read too often.
|
||||
dbuf = ByteBuffer.allocate(Math.min(Math.max(parser.maxMessageSize, BUFFER_SIZE_LOWER_BOUND), BUFFER_SIZE_UPPER_BOUND));
|
||||
dbuf = ByteBuffer.allocateDirect(Math.min(Math.max(parser.maxMessageSize, BUFFER_SIZE_LOWER_BOUND), BUFFER_SIZE_UPPER_BOUND));
|
||||
parser.setWriteTarget(this);
|
||||
sc = SocketChannel.open();
|
||||
|
||||
|
@ -64,7 +64,7 @@ public class ProtobufServer {
|
||||
throw new IOException("Parser factory.getNewParser returned null");
|
||||
}
|
||||
this.parser = newParser;
|
||||
dbuf = ByteBuffer.allocate(Math.min(Math.max(newParser.maxMessageSize, BUFFER_SIZE_LOWER_BOUND), BUFFER_SIZE_UPPER_BOUND));
|
||||
dbuf = ByteBuffer.allocateDirect(Math.min(Math.max(newParser.maxMessageSize, BUFFER_SIZE_LOWER_BOUND), BUFFER_SIZE_UPPER_BOUND));
|
||||
newParser.setWriteTarget(this);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user