-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Remove RTT check before reading a response from the server. #1391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -509,6 +502,16 @@ private <T> void sendCommandMessageAsync(final int messageId, final Decoder<T> d | |||
final SingleResultCallback<T> callback, final ByteBufferBsonOutput bsonOutput, | |||
final CommandEventSender commandEventSender, final boolean responseExpected) { | |||
List<ByteBuf> byteBuffers = bsonOutput.getByteBuffers(); | |||
|
|||
boolean[] shouldReturn = {false}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've moved this check from "after the write is complete" to "before a message is send."
According to the CSOT spec:
After wire message construction, drivers MUST check for timeout before writing the message to the server.
@@ -349,9 +349,6 @@ public <T> T sendAndReceive(final CommandMessage message, final Decoder<T> decod | |||
CommandEventSender commandEventSender; | |||
|
|||
try (ByteBufferBsonOutput bsonOutput = new ByteBufferBsonOutput(this)) { | |||
Timeout.onExistsAndExpired(operationContext.getTimeoutContext().timeoutIncludingRoundTrip(), () -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the specification:
After wire message construction, drivers MUST check for timeout before writing the message to the server.
I have removed this check from its previous position as it was occurring before the wire message was constructed, not after, which is contrary to the spec. We still perform this necessary timeout check later in the code within the trySendMessage
method, just before writing the message to the socket.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
JAVA-5473