ensure that our MTU discovery will not try an MTU smaller than the minimum.

This commit is contained in:
Nikos Mavrogiannopoulos
2014-01-30 14:01:54 +01:00
parent 4a1f5a1162
commit 6f25bf1889
+10 -8
View File
@@ -848,17 +848,19 @@ void mtu_set(worker_st * ws, unsigned mtu)
static
int mtu_not_ok(worker_st * ws)
{
unsigned min = MIN_MTU(ws);
ws->last_bad_mtu = ws->conn_mtu;
if (ws->last_good_mtu >= ws->conn_mtu) {
ws->last_good_mtu = (2 * (ws->conn_mtu)) / 3;
if (ws->last_good_mtu == min) {
oclog(ws, LOG_INFO,
"could not calculate a sufficient MTU. Disabling DTLS.");
ws->udp_state = UP_DISABLED;
return -1;
}
if (ws->last_good_mtu < MIN_MTU(ws)) {
oclog(ws, LOG_INFO,
"could not calculate a sufficient MTU. Disabling DTLS.");
ws->udp_state = UP_DISABLED;
return -1;
}
if (ws->last_good_mtu >= ws->conn_mtu) {
ws->last_good_mtu = MAX(((2 * (ws->conn_mtu)) / 3), min);
}
mtu_set(ws, ws->last_good_mtu);