Skip to content

Commit

Permalink
Bump the minimum MTU up to 1KiB.
Browse files Browse the repository at this point in the history
If anyone is getting -1 from getMtu, we should give them a more
reasonable default.
  • Loading branch information
squarejesse committed May 10, 2013
1 parent c5f9479 commit 3ba54ee
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion okhttp/src/main/java/com/squareup/okhttp/Connection.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ 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 < 1024) mtu = 1024;
if (mtu > 8192) mtu = 8192;
in = new BufferedInputStream(in, mtu);
out = new BufferedOutputStream(out, mtu);
Expand Down

0 comments on commit 3ba54ee

Please sign in to comment.