mirror of
https://github.com/square/okhttp.git
synced 2026-01-27 04:22:07 +03:00
Merge pull request #157 from square/jwilson/no_interface
Don't explode if we can't find an interface for a local address.
This commit is contained in:
@@ -201,6 +201,9 @@ public class Platform {
|
||||
try {
|
||||
NetworkInterface networkInterface = NetworkInterface.getByInetAddress(
|
||||
socket.getLocalAddress());
|
||||
if (networkInterface == null) {
|
||||
return super.getMtu(socket); // There's no longer an interface with this local address.
|
||||
}
|
||||
return (Integer) getMtu.invoke(networkInterface);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new AssertionError(e);
|
||||
|
||||
Reference in New Issue
Block a user