uTP fix for loopback on mac

This commit is contained in:
Arvid Norberg
2013-02-25 05:09:35 +00:00
parent a0caa0f4b2
commit c40a35e90b
2 changed files with 35 additions and 2 deletions

View File

@@ -136,6 +136,17 @@ namespace libtorrent
else mtu = TORRENT_ETHERNET_MTU;
}
#if defined __APPLE__
// apple has a very strange loopback. It appears you can't
// send messages of the reported MTU size, and you don't get
// EWOULDBLOCK either.
if (is_loopback(addr))
{
if (is_teredo(addr)) mtu = TORRENT_TEREDO_MTU;
else mtu = TORRENT_ETHERNET_MTU;
}
#endif
// clamp the MTU within reasonable bounds
if (mtu < TORRENT_INET_MIN_MTU) mtu = TORRENT_INET_MIN_MTU;
else if (mtu > TORRENT_INET_MAX_MTU) mtu = TORRENT_INET_MAX_MTU;