Skip to content

Commit

Permalink
Merge pull request square#185 from square/jwilson/clamp_mtu
Browse files Browse the repository at this point in the history
Clamp the MTU to a reasonable range.
  • Loading branch information
swankjesse committed May 10, 2013
2 parents 8bf24a5 + bb1b1a2 commit c5f9479
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions okhttp/src/main/java/com/squareup/okhttp/Connection.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ public void connect(int connectTimeout, int readTimeout, TunnelRequest tunnelReq

// Use MTU-sized buffers to send fewer packets.
int mtu = Platform.get().getMtu(socket);
if (mtu < 256) mtu = 256;
if (mtu > 8192) mtu = 8192;
in = new BufferedInputStream(in, mtu);
out = new BufferedOutputStream(out, mtu);
}
Expand Down

0 comments on commit c5f9479

Please sign in to comment.