Bug 1363372 - Test tfo: send only small part of tfo data. r=mcmanus

This commit is contained in:
Dragana Damjanovic dd.mozilla@gmail.com 2017-07-17 23:50:57 +02:00
Родитель 4772055bc5
Коммит 3d59bf74c8
2 изменённых файлов: 5 добавлений и 3 удалений

Просмотреть файл

@ -4735,7 +4735,7 @@ pref("network.tcp.keepalive.retry_interval", 1); // seconds
pref("network.tcp.keepalive.probe_count", 4);
#endif
pref("network.tcp.tcp_fastopen_enable", false);
pref("network.tcp.tcp_fastopen_enable", true);
pref("network.tcp.tcp_fastopen_consecutive_failure_limit", 5);
// Whether to disable acceleration for all widgets.

Просмотреть файл

@ -378,7 +378,7 @@ TCPFastOpenFinish(PRFileDesc *fd, PRErrorCode &err,
// If sendto is not implemented it points to _PR_InvalidInt, therefore we
// check if sendto != _PR_InvalidInt. _PR_InvalidInt is exposed so we use
// reserved_fn_0 which also points to _PR_InvalidInt.
if (!secret->mFirstPacketBufLen ||
if ((secret->mFirstPacketBufLen < 10) ||
(tfoFd->lower->methods->sendto == (PRSendtoFN)tfoFd->lower->methods->reserved_fn_0)) {
// Because of the way our nsHttpTransaction dispatch work, it can happened
// that data has not been written into the socket.
@ -399,15 +399,17 @@ TCPFastOpenFinish(PRFileDesc *fd, PRErrorCode &err,
} else {
// We have some data ready in the buffer we will send it with the syn
// packet.
MOZ_ASSERT(secret->mFirstPacketBufLen >= 10);
PRInt32 rv = (tfoFd->lower->methods->sendto)(tfoFd->lower,
secret->mFirstPacketBuf,
secret->mFirstPacketBufLen,
10,
0, //flags
&secret->mAddr,
PR_INTERVAL_NO_WAIT);
SOCKET_LOG(("TCPFastOpenFinish - sendto result=%d.\n", rv));
if (rv > 0) {
MOZ_DIAGNOSTIC_ASSERT(rv <= 10);
result = PR_IN_PROGRESS_ERROR;
secret->mFirstPacketBufLen -= rv;
if (secret->mFirstPacketBufLen) {