Skip to content

Commit

Permalink
Merge pull request square#2529 from square/jwilson_0502_okio
Browse files Browse the repository at this point in the history
Upgrade to Okio 1.8.0.
  • Loading branch information
JakeWharton committed May 2, 2016
2 parents 312ebb3 + ba51f5b commit be605dd
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion okhttp-tests/src/test/java/okhttp3/SocksProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ private void transfer(final InetAddress fromAddress, final InetAddress toAddress
Buffer buffer = new Buffer();
try {
while (true) {
long byteCount = source.read(buffer, 2048L);
long byteCount = source.read(buffer, 8192L);
if (byteCount == -1L) break;
sink.write(buffer, byteCount);
sink.emit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,16 @@ public final class WebSocketWriterTest {
sink.write(body.readByteString(20_000));
sink.close();

assertData("017e4800");
assertData(bytes.readByteArray(18_432));
assertData("007e5000");
assertData(bytes.readByteArray(20_480));
assertData("007e5000");
assertData(bytes.readByteArray(20_480));
assertData("007e5000");
assertData(bytes.readByteArray(20_480));
assertData("007e4800");
assertData(bytes.readByteArray(18_432));
assertData("017e4000");
assertData(bytes.readByteArray(16_384));
assertData("007e4000");
assertData(bytes.readByteArray(16_384));
assertData("007e6000");
assertData(bytes.readByteArray(24_576));
assertData("007e4000");
assertData(bytes.readByteArray(16_384));
assertData("007e6000");
assertData(bytes.readByteArray(24_576));
assertData("807e06a0");
assertData(bytes.readByteArray(1_696));
assertTrue(data.exhausted());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public interface FrameCallback {
private boolean isMasked;

private final byte[] maskKey = new byte[4];
private final byte[] maskBuffer = new byte[2048];
private final byte[] maskBuffer = new byte[8192];

public WebSocketReader(boolean isClient, BufferedSource source, FrameCallback frameCallback) {
if (source == null) throw new NullPointerException("source == null");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public WebSocketWriter(boolean isClient, BufferedSink sink, Random random) {

// Masks are only a concern for client writers.
maskKey = isClient ? new byte[4] : null;
maskBuffer = isClient ? new byte[2048] : null;
maskBuffer = isClient ? new byte[8192] : null;
}

/** Send a ping with the supplied {@code payload}. Payload may be {@code null} */
Expand Down Expand Up @@ -239,7 +239,7 @@ private final class FrameSink implements Sink {
// Determine if this is a buffered write which we can defer until close() flushes.
boolean deferWrite = isFirstFrame
&& contentLength != -1
&& buffer.size() > contentLength - 2048 /* segment size */;
&& buffer.size() > contentLength - 8192 /* segment size */;

long emitCount = buffer.completeSegmentByteCount();
if (emitCount > 0 && !deferWrite) {
Expand Down
2 changes: 1 addition & 1 deletion okhttp/src/main/java/okhttp3/internal/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public static boolean skipAll(Source source, int duration, TimeUnit timeUnit) th
source.timeout().deadlineNanoTime(now + Math.min(originalDuration, timeUnit.toNanos(duration)));
try {
Buffer skipBuffer = new Buffer();
while (source.read(skipBuffer, 2048) != -1) {
while (source.read(skipBuffer, 8192) != -1) {
skipBuffer.clear();
}
return true; // Success! The source has been exhausted.
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<guava.version>16.0</guava.version>
<java.version>1.7</java.version>
<moshi.version>1.1.0</moshi.version>
<okio.version>1.6.0</okio.version>
<okio.version>1.8.0</okio.version>

<!-- Test Dependencies -->
<junit.version>4.12</junit.version>
Expand Down

0 comments on commit be605dd

Please sign in to comment.