mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-09 00:11:44 +00:00
Bug 1372579, uplift NSPR_4_16_BETA2, r=me
UPGRADE_NSPR_RELEASE --HG-- extra : amend_source : f023c38ec4b7a96dd794e50832ca016c124e9728
This commit is contained in:
parent
0f5cb4866e
commit
f2a78cd788
@ -1 +1 @@
|
|||||||
NSPR_4_16_BETA1
|
NSPR_4_16_BETA2
|
||||||
|
@ -10,4 +10,3 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#error "Do not include this header file."
|
#error "Do not include this header file."
|
||||||
|
|
||||||
|
@ -322,7 +322,7 @@ static PRStatus PR_CALLBACK SocketConnectContinue(
|
|||||||
PR_ASSERT(fd->secret->nonblocking);
|
PR_ASSERT(fd->secret->nonblocking);
|
||||||
PRInt32 rvSent;
|
PRInt32 rvSent;
|
||||||
if (GetOverlappedResult(osfd, &fd->secret->ol, &rvSent, FALSE) == TRUE) {
|
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,
|
PR_LOG(_pr_io_lm, PR_LOG_MIN,
|
||||||
("SocketConnectContinue GetOverlappedResult succeeded\n"));
|
("SocketConnectContinue GetOverlappedResult succeeded\n"));
|
||||||
/* When ConnectEx is used, all previously set socket options and
|
/* 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));
|
("SocketConnectContinue GetOverlappedResult failed %d\n", err));
|
||||||
if (err != ERROR_IO_INCOMPLETE) {
|
if (err != ERROR_IO_INCOMPLETE) {
|
||||||
_PR_MD_MAP_CONNECT_ERROR(err);
|
_PR_MD_MAP_CONNECT_ERROR(err);
|
||||||
fd->secret->overlappedActive = FALSE;
|
fd->secret->overlappedActive = PR_FALSE;
|
||||||
return PR_FAILURE;
|
return PR_FAILURE;
|
||||||
} else {
|
} else {
|
||||||
PR_SetError(PR_IN_PROGRESS_ERROR, 0);
|
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)
|
#if defined(_WIN64)
|
||||||
|
|
||||||
static PRCallOnceType _pr_has_connectex_once;
|
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
|
#ifndef WSAID_CONNECTEX
|
||||||
#define WSAID_CONNECTEX \
|
#define WSAID_CONNECTEX \
|
||||||
{0x25a207b9,0xddf3,0x4660,{0x8e,0xe9,0x76,0xe5,0x8c,0x74,0x06,0x3e}}
|
{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
|
#define SO_UPDATE_CONNECT_CONTEXT 0x7010
|
||||||
#endif
|
#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)
|
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);
|
_PR_MD_MAP_CONNECT_ERROR(err);
|
||||||
return -1;
|
return -1;
|
||||||
} else if (fd->secret->nonblocking) {
|
} 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. */
|
* the final result of ConnectEx call. */
|
||||||
fd->secret->overlappedActive = PR_TRUE;
|
fd->secret->overlappedActive = PR_TRUE;
|
||||||
_PR_MD_MAP_CONNECT_ERROR(WSAEWOULDBLOCK);
|
|
||||||
/* ConnectEx will copy supplied data to a internal buffer and send
|
/* ConnectEx will copy supplied data to a internal buffer and send
|
||||||
* them during Fast Open or after connect. Therefore we can assumed
|
* them during Fast Open or after connect. Therefore we can assumed
|
||||||
* this data already send. */
|
* 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
|
// err is ERROR_IO_PENDING and socket is blocking, so query
|
||||||
// GetOverlappedResult.
|
// GetOverlappedResult.
|
||||||
|
@ -55,11 +55,10 @@ void _PR_InitLocks(void)
|
|||||||
rv = _PT_PTHREAD_MUTEXATTR_INIT(&_pt_mattr);
|
rv = _PT_PTHREAD_MUTEXATTR_INIT(&_pt_mattr);
|
||||||
PR_ASSERT(0 == rv);
|
PR_ASSERT(0 == rv);
|
||||||
|
|
||||||
#ifdef LINUX
|
#if (defined(LINUX) && (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) || \
|
||||||
#if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
|
(defined(FREEBSD) && __FreeBSD_version > 700055)
|
||||||
rv = pthread_mutexattr_settype(&_pt_mattr, PTHREAD_MUTEX_ADAPTIVE_NP);
|
rv = pthread_mutexattr_settype(&_pt_mattr, PTHREAD_MUTEX_ADAPTIVE_NP);
|
||||||
PR_ASSERT(0 == rv);
|
PR_ASSERT(0 == rv);
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rv = _PT_PTHREAD_CONDATTR_INIT(&_pt_cvar_attr);
|
rv = _PT_PTHREAD_CONDATTR_INIT(&_pt_cvar_attr);
|
||||||
|
@ -143,12 +143,13 @@ ClientThread(void *_action)
|
|||||||
if (action != CLIENT_TIMEOUT_SEND) {
|
if (action != CLIENT_TIMEOUT_SEND) {
|
||||||
if ((rv = PR_Send(sock, buf, CLIENT_DATA,
|
if ((rv = PR_Send(sock, buf, CLIENT_DATA,
|
||||||
0, timeoutTime))< 0) {
|
0, timeoutTime))< 0) {
|
||||||
if (!debug_mode)
|
if (!debug_mode) {
|
||||||
failed_already=1;
|
failed_already=1;
|
||||||
else
|
} else {
|
||||||
PR_fprintf(output,
|
PR_fprintf(output,
|
||||||
"client: unable to send to server (%d, %ld, %ld)\n",
|
"client: unable to send to server (%d, %ld, %ld)\n",
|
||||||
CLIENT_DATA, rv, PR_GetError());
|
CLIENT_DATA, rv, PR_GetError());
|
||||||
|
}
|
||||||
goto ErrorExit;
|
goto ErrorExit;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -200,8 +201,9 @@ int i;
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
failed_already=1;
|
failed_already=1;
|
||||||
if (debug_mode)
|
if (debug_mode) {
|
||||||
PR_fprintf(output,"accept: ERROR - PR_Bind failed\n");
|
PR_fprintf(output,"accept: ERROR - PR_Bind failed\n");
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,15 +411,15 @@ static PRUint32 TimeThis(
|
|||||||
PRUint32 overhead, usecs;
|
PRUint32 overhead, usecs;
|
||||||
PRIntervalTime predicted, timein, timeout, ticks;
|
PRIntervalTime predicted, timein, timeout, ticks;
|
||||||
|
|
||||||
if (debug_mode)
|
if (debug_mode)
|
||||||
printf("Testing %s ...", msg);
|
printf("Testing %s ...", msg);
|
||||||
|
|
||||||
timein = PR_IntervalNow();
|
timein = PR_IntervalNow();
|
||||||
predicted = func(loops);
|
predicted = func(loops);
|
||||||
timeout = PR_IntervalNow();
|
timeout = PR_IntervalNow();
|
||||||
|
|
||||||
if (debug_mode)
|
if (debug_mode)
|
||||||
printf(" done\n");
|
printf(" done\n");
|
||||||
|
|
||||||
ticks = timeout - timein;
|
ticks = timeout - timein;
|
||||||
usecs = PR_IntervalToMicroseconds(ticks);
|
usecs = PR_IntervalToMicroseconds(ticks);
|
||||||
@ -491,17 +491,17 @@ int prmain(int argc, char** argv)
|
|||||||
|
|
||||||
for (cpu = 1; cpu <= cpus; ++cpu)
|
for (cpu = 1; cpu <= cpus; ++cpu)
|
||||||
{
|
{
|
||||||
if (debug_mode)
|
if (debug_mode)
|
||||||
printf("\nAlarm: Using %d CPU(s)\n", cpu);
|
printf("\nAlarm: Using %d CPU(s)\n", cpu);
|
||||||
|
|
||||||
PR_SetConcurrency(cpu);
|
PR_SetConcurrency(cpu);
|
||||||
|
|
||||||
/* some basic time test */
|
/* some basic time test */
|
||||||
(void)TimeThis("ConditionNotify", ConditionNotify, loops);
|
(void)TimeThis("ConditionNotify", ConditionNotify, loops);
|
||||||
(void)TimeThis("ConditionTimeout", ConditionTimeout, loops);
|
(void)TimeThis("ConditionTimeout", ConditionTimeout, loops);
|
||||||
(void)TimeThis("Alarms1", Alarms1, loops);
|
(void)TimeThis("Alarms1", Alarms1, loops);
|
||||||
(void)TimeThis("Alarms2", Alarms2, loops);
|
(void)TimeThis("Alarms2", Alarms2, loops);
|
||||||
(void)TimeThis("Alarms3", Alarms3, loops);
|
(void)TimeThis("Alarms3", Alarms3, loops);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user