okhttp: Make implicit cast explicit to declare it safe

This commit is contained in:
Eric Anderson 2017-05-15 09:06:11 -07:00
parent cf0e161bd6
commit 3fc8163fbd
1 changed files with 3 additions and 1 deletions

View File

@ -282,7 +282,9 @@ class OkHttpClientStream extends AbstractClientStream2 {
*/ */
@GuardedBy("lock") @GuardedBy("lock")
public void transportDataReceived(okio.Buffer frame, boolean endOfStream) { public void transportDataReceived(okio.Buffer frame, boolean endOfStream) {
long length = frame.size(); // We only support 16 KiB frames, and the max permitted in HTTP/2 is 16 MiB. This is verified
// in OkHttp's Http2 deframer. In addition, this code is after the data has been read.
int length = (int) frame.size();
window -= length; window -= length;
if (window < 0) { if (window < 0) {
frameWriter.rstStream(id(), ErrorCode.FLOW_CONTROL_ERROR); frameWriter.rstStream(id(), ErrorCode.FLOW_CONTROL_ERROR);