Bug 1372579, uplift NSPR_4_16_BETA2, r=me

UPGRADE_NSPR_RELEASE

--HG--
extra : amend_source : f023c38ec4b7a96dd794e50832ca016c124e9728
This commit is contained in:
Kai Engert 2017-07-14 17:23:45 +02:00
Родитель 0f5cb4866e
Коммит f2a78cd788
7 изменённых файлов: 37 добавлений и 29 удалений

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

@ -1 +1 @@
NSPR_4_16_BETA1
NSPR_4_16_BETA2

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

@ -10,4 +10,3 @@
*/
#error "Do not include this header file."

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

@ -322,7 +322,7 @@ static PRStatus PR_CALLBACK SocketConnectContinue(
PR_ASSERT(fd->secret->nonblocking);
PRInt32 rvSent;
if (GetOverlappedResult(osfd, &fd->secret->ol, &rvSent, FALSE) == TRUE) {
fd->secret->overlappedActive = FALSE;
fd->secret->overlappedActive = PR_FALSE;
PR_LOG(_pr_io_lm, PR_LOG_MIN,
("SocketConnectContinue GetOverlappedResult succeeded\n"));
/* When ConnectEx is used, all previously set socket options and
@ -342,7 +342,7 @@ static PRStatus PR_CALLBACK SocketConnectContinue(
("SocketConnectContinue GetOverlappedResult failed %d\n", err));
if (err != ERROR_IO_INCOMPLETE) {
_PR_MD_MAP_CONNECT_ERROR(err);
fd->secret->overlappedActive = FALSE;
fd->secret->overlappedActive = PR_FALSE;
return PR_FAILURE;
} else {
PR_SetError(PR_IN_PROGRESS_ERROR, 0);

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

@ -333,7 +333,10 @@ _PR_MD_SENDTO(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags,
#if defined(_WIN64)
static PRCallOnceType _pr_has_connectex_once;
typedef BOOL (WINAPI *_pr_win_connectex_ptr)(SOCKET, const struct sockaddr *, int, PVOID, DWORD, LPDWORD, LPOVERLAPPED);
typedef BOOL (PASCAL FAR * _pr_win_connectex_ptr)(_In_ SOCKET s, _In_reads_bytes_(namelen) const struct sockaddr FAR *name, _In_ int namelen, _In_reads_bytes_opt_(dwSendDataLength) PVOID lpSendBuffer, _In_ DWORD dwSendDataLength, _Out_ LPDWORD lpdwBytesSent, _Inout_ LPOVERLAPPED lpOverlapped);
#ifndef WSAID_CONNECTEX
#define WSAID_CONNECTEX \
{0x25a207b9,0xddf3,0x4660,{0x8e,0xe9,0x76,0xe5,0x8c,0x74,0x06,0x3e}}
@ -349,7 +352,7 @@ typedef BOOL (WINAPI *_pr_win_connectex_ptr)(SOCKET, const struct sockaddr *, in
#define SO_UPDATE_CONNECT_CONTEXT 0x7010
#endif
static _pr_win_connectex_ptr _pr_win_connectex;
static _pr_win_connectex_ptr _pr_win_connectex = NULL;
static PRStatus PR_CALLBACK _pr_set_connectex(void)
{
@ -458,14 +461,19 @@ _PR_MD_TCPSENDTO(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags,
_PR_MD_MAP_CONNECT_ERROR(err);
return -1;
} else if (fd->secret->nonblocking) {
/* Remember that overlapped structure is set. We will neede to get
/* Remember that overlapped structure is set. We will need to get
* the final result of ConnectEx call. */
fd->secret->overlappedActive = PR_TRUE;
_PR_MD_MAP_CONNECT_ERROR(WSAEWOULDBLOCK);
/* ConnectEx will copy supplied data to a internal buffer and send
* them during Fast Open or after connect. Therefore we can assumed
* this data already send. */
return amount;
if (amount > 0) {
return amount;
}
_PR_MD_MAP_CONNECT_ERROR(WSAEWOULDBLOCK);
return -1;
}
// err is ERROR_IO_PENDING and socket is blocking, so query
// GetOverlappedResult.

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

@ -55,11 +55,10 @@ void _PR_InitLocks(void)
rv = _PT_PTHREAD_MUTEXATTR_INIT(&_pt_mattr);
PR_ASSERT(0 == rv);
#ifdef LINUX
#if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
#if (defined(LINUX) && (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) || \
(defined(FREEBSD) && __FreeBSD_version > 700055)
rv = pthread_mutexattr_settype(&_pt_mattr, PTHREAD_MUTEX_ADAPTIVE_NP);
PR_ASSERT(0 == rv);
#endif
#endif
rv = _PT_PTHREAD_CONDATTR_INIT(&_pt_cvar_attr);

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

@ -143,12 +143,13 @@ ClientThread(void *_action)
if (action != CLIENT_TIMEOUT_SEND) {
if ((rv = PR_Send(sock, buf, CLIENT_DATA,
0, timeoutTime))< 0) {
if (!debug_mode)
if (!debug_mode) {
failed_already=1;
else
PR_fprintf(output,
} else {
PR_fprintf(output,
"client: unable to send to server (%d, %ld, %ld)\n",
CLIENT_DATA, rv, PR_GetError());
}
goto ErrorExit;
}
} else {
@ -200,8 +201,9 @@ int i;
continue;
}
failed_already=1;
if (debug_mode)
if (debug_mode) {
PR_fprintf(output,"accept: ERROR - PR_Bind failed\n");
}
return;
}

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

@ -411,15 +411,15 @@ static PRUint32 TimeThis(
PRUint32 overhead, usecs;
PRIntervalTime predicted, timein, timeout, ticks;
if (debug_mode)
printf("Testing %s ...", msg);
if (debug_mode)
printf("Testing %s ...", msg);
timein = PR_IntervalNow();
predicted = func(loops);
timeout = PR_IntervalNow();
if (debug_mode)
printf(" done\n");
if (debug_mode)
printf(" done\n");
ticks = timeout - timein;
usecs = PR_IntervalToMicroseconds(ticks);
@ -491,17 +491,17 @@ int prmain(int argc, char** argv)
for (cpu = 1; cpu <= cpus; ++cpu)
{
if (debug_mode)
if (debug_mode)
printf("\nAlarm: Using %d CPU(s)\n", cpu);
PR_SetConcurrency(cpu);
/* some basic time test */
(void)TimeThis("ConditionNotify", ConditionNotify, loops);
(void)TimeThis("ConditionTimeout", ConditionTimeout, loops);
(void)TimeThis("Alarms1", Alarms1, loops);
(void)TimeThis("Alarms2", Alarms2, loops);
(void)TimeThis("Alarms3", Alarms3, loops);
PR_SetConcurrency(cpu);
/* some basic time test */
(void)TimeThis("ConditionNotify", ConditionNotify, loops);
(void)TimeThis("ConditionTimeout", ConditionTimeout, loops);
(void)TimeThis("Alarms1", Alarms1, loops);
(void)TimeThis("Alarms2", Alarms2, loops);
(void)TimeThis("Alarms3", Alarms3, loops);
}
return 0;
}