mirror of https://github.com/grpc/grpc-java.git
Deframer.deframe returns number of unprocessed bytes.
This is intended to reduce the flakiness of test_TestServiceBenchmarks. TAP showed some flaky runs where HttpStreamDeframer threw the exception "GRPC stream not correctly aligned". ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=69166650
This commit is contained in:
parent
9334b6fa32
commit
88a758236a
|
|
@ -22,15 +22,17 @@ public class InputStreamDeframer extends Deframer<InputStream> {
|
|||
|
||||
/**
|
||||
* Deframing a single input stream that contains multiple GRPC frames
|
||||
*
|
||||
* @return the number of unconsumed bytes remaining in the buffer
|
||||
*/
|
||||
@Override
|
||||
public int deframe(InputStream frame, Operation target) {
|
||||
try {
|
||||
int read = 0;
|
||||
while (frame.available() > 0) {
|
||||
read += super.deframe(frame, target);
|
||||
}
|
||||
return read;
|
||||
int remaining;
|
||||
do {
|
||||
remaining = super.deframe(frame, target);
|
||||
} while (frame.available() > 0);
|
||||
return remaining;
|
||||
} catch (IOException ioe) {
|
||||
throw new RuntimeException(ioe);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue