1
0
mirror of https://github.com/square/okhttp.git synced 2026-01-25 16:01:38 +03:00

Don't explode if NetworkInterface.getByInetAddress does.

Certain Motorola RAZRs always throw a SocketException when
you call that method. We don't _really_ need a perfect MTU,
so for those devices just return the default MTU.
This commit is contained in:
jwilson
2013-05-10 19:53:12 -04:00
parent 3ba54eed34
commit d7e24381a3

View File

@@ -205,6 +205,9 @@ public class Platform {
return super.getMtu(socket); // There's no longer an interface with this local address.
}
return (Integer) getMtu.invoke(networkInterface);
} catch (SocketException e) {
// Certain Motorola devices always throw on getByInetAddress. Return the default for those.
return super.getMtu(socket);
} catch (IllegalAccessException e) {
throw new AssertionError(e);
} catch (InvocationTargetException e) {