author | Dragana Damjanovic dd.mozilla@gmail.com |
Mon, 24 Apr 2017 17:32:23 +0200 | |
changeset 354651 | 79b05b19ce92c09c12d0cc464d46a25acb8bf604 |
parent 354650 | df17c800d8f2c36d218f92e9fd2f65a9013f6c43 |
child 354652 | 8d2645bc72849e499daa26972a99b4307a395d95 |
push id | 31707 |
push user | kwierso@gmail.com |
push date | Mon, 24 Apr 2017 22:53:41 +0000 |
treeherder | mozilla-central@abdcc8dfc283 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | mcmanus |
bugs | 1358466 |
milestone | 55.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/nsprpub/pr/src/io/prsocket.c +++ b/nsprpub/pr/src/io/prsocket.c @@ -310,29 +310,29 @@ static PRStatus PR_CALLBACK SocketConnec } PR_ASSERT(out_flags & PR_POLL_WRITE); #if defined(_WIN64) if (fd->secret->alreadyConnected) { fd->secret->alreadyConnected = PR_FALSE; } - // TCP Fast Open on Windows must use ConnectEx, which uses overlapped - // input/output. - // To get result we need to use GetOverlappedResult. + /* TCP Fast Open on Windows must use ConnectEx, which uses overlapped + * input/output. + * To get result we need to use GetOverlappedResult. */ if (fd->secret->overlappedActive) { PR_ASSERT(fd->secret->nonblocking); PRInt32 rvSent; if (GetOverlappedResult(osfd, &fd->secret->ol, &rvSent, FALSE) == TRUE) { fd->secret->overlappedActive = FALSE; PR_LOG(_pr_io_lm, PR_LOG_MIN, ("SocketConnectContinue GetOverlappedResult succeeded\n")); - // When ConnectEx is used, all previously set socket options and - // property are not enabled and to enable them - // SO_UPDATE_CONNECT_CONTEXT option need to be set. + /* When ConnectEx is used, all previously set socket options and + * property are not enabled and to enable them + * SO_UPDATE_CONNECT_CONTEXT option need to be set. */ if (setsockopt((SOCKET)osfd, SOL_SOCKET, SO_UPDATE_CONNECT_CONTEXT, NULL, 0) != 0) { err = WSAGetLastError(); PR_LOG(_pr_io_lm, PR_LOG_MIN, ("SocketConnectContinue setting SO_UPDATE_CONNECT_CONTEXT failed %d\n", err)); _PR_MD_MAP_SETSOCKOPT_ERROR(err); return PR_FAILURE; } return PR_SUCCESS; @@ -1193,17 +1193,17 @@ static PRIOMethods tcpMethods = { SocketAccept, SocketBind, SocketListen, SocketShutdown, SocketRecv, SocketSend, (PRRecvfromFN)_PR_InvalidInt, #if defined(_WIN64) && defined(WIN95) - SocketTCPSendTo, // This is for fast open. We imitate Linux interface. + SocketTCPSendTo, /* This is for fast open. We imitate Linux interface. */ #else (PRSendtoFN)_PR_InvalidInt, #endif SocketPoll, SocketAcceptRead, SocketTransmitFile, SocketGetName, SocketGetPeerName,
--- a/nsprpub/pr/src/md/windows/w95sock.c +++ b/nsprpub/pr/src/md/windows/w95sock.c @@ -405,17 +405,17 @@ PRInt32 if (err == WSAENOPROTOOPT) { PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); } else { _PR_MD_MAP_SETSOCKOPT_ERROR(err); } return -1; } - // ConnectEx requires the socket to be initially bound. We will use INADDR_ANY + /* ConnectEx requires the socket to be initially bound. We will use INADDR_ANY. */ PRNetAddr bindAddr; memset(&bindAddr, 0, sizeof(bindAddr)); if (addr->raw.family == PR_AF_INET) { bindAddr.inet.family = PR_AF_INET; } else if (addr->raw.family == PR_AF_INET6) { bindAddr.ipv6.family = PR_AF_INET6; } rv = bind((SOCKET)osfd, (SOCKADDR*) &bindAddr, sizeof(bindAddr)); @@ -427,52 +427,52 @@ PRInt32 return -1; } PR_LOG(_pr_io_lm, PR_LOG_MIN, ("_PR_MD_TCPSENDTO calling _pr_win_connectex %d %p\n", amount, (char*)buf)); rvSent = 0; memset(&fd->secret->ol, 0, sizeof(fd->secret->ol)); - // ConnectEx return TRUE on a success and FALSE on an error. + /* ConnectEx return TRUE on a success and FALSE on an error. */ if (_pr_win_connectex( (SOCKET)osfd, (struct sockaddr *) addr, addrlen, buf, amount, &rvSent, &fd->secret->ol) == TRUE) { - // When ConnectEx is used, all previously set socket options and - // property are not enabled and to enable them - // SO_UPDATE_CONNECT_CONTEXT option need to be set. + /* When ConnectEx is used, all previously set socket options and + * property are not enabled and to enable them + * SO_UPDATE_CONNECT_CONTEXT option need to be set. */ rv = setsockopt((SOCKET)osfd, SOL_SOCKET, SO_UPDATE_CONNECT_CONTEXT, NULL, 0); if (rv != 0) { err = WSAGetLastError(); PR_LOG(_pr_io_lm, PR_LOG_MIN, ("_PR_MD_TCPSENDTO setting SO_UPDATE_CONNECT_CONTEXT failed %d\n", err)); _PR_MD_MAP_SETSOCKOPT_ERROR(err); return -1; } - // We imitate Linux here. SendTo will return number of bytes send but - // it can not return connection success at the same time, so we return - // number of bytes send and "connection success" will be return on the - // connectcontinue. + /* We imitate Linux here. SendTo will return number of bytes send but + * it can not return connection success at the same time, so we return + * number of bytes send and "connection success" will be return on the + * connectcontinue. */ fd->secret->alreadyConnected = PR_TRUE; return rvSent; } else { err = WSAGetLastError(); PR_LOG(_pr_io_lm, PR_LOG_MIN, ("_PR_MD_TCPSENDTO error _pr_win_connectex failed %d\n", err)); if (err != ERROR_IO_PENDING) { _PR_MD_MAP_CONNECT_ERROR(err); return -1; } else if (fd->secret->nonblocking) { - // Remember that overlapped structure is set. We will neede to get - // the final result of ConnectEx call. + /* Remember that overlapped structure is set. We will neede 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. + /* 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; } while (err == ERROR_IO_PENDING) { rv = socket_io_wait(osfd, WRITE_FD, timeout); if ( rv < 0 ) { return -1; } rv = GetOverlappedResult(osfd, &fd->secret->ol, &rvSent, FALSE);
--- a/nsprpub/pr/src/pthreads/ptio.c +++ b/nsprpub/pr/src/pthreads/ptio.c @@ -2051,24 +2051,25 @@ static PRInt32 pt_SendTo( bytes = pt_Continue(&op); syserrno = op.syserrno; } if (bytes < 0) pt_MapError(_PR_MD_MAP_SENDTO_ERROR, syserrno); return bytes; } /* pt_SendTo */ -// Linux uses SendTo to send data during TCP Fast Open. OSX uses connectx, but -// we will make it imitate the Linux's interface. +#if defined(LINUX) || defined(DARWIN) +/* Linux uses SendTo to send data during TCP Fast Open. OSX uses connectx, but + * we will make it imitate the Linux's interface. */ static PRInt32 pt_TCP_SendTo( PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, const PRNetAddr *addr, PRIntervalTime timeout) { -#if !defined(DARWIN) || HAS_CONNECTX +#if defined(LINUX) || HAS_CONNECTX PRInt32 syserrno, bytes = -1; PRBool fNeedContinue = PR_FALSE; pt_SockLen addr_len; const PRNetAddr *addrp = addr; #if defined(_PR_HAVE_SOCKADDR_LEN) || defined(_PR_INET6) PRNetAddr addrCopy; #endif #ifdef _PR_HAVE_SOCKADDR_LEN @@ -2079,28 +2080,28 @@ static PRInt32 pt_TCP_SendTo( PR_ASSERT(IsValidNetAddr(addr) == PR_TRUE); addr_len = PR_NETADDR_SIZE(addr); #if defined(_PR_INET6) if (addr->raw.family == PR_AF_INET6) { #ifdef _PR_HAVE_SOCKADDR_LEN md_af = AF_INET6; #else - // If _PR_INET6 is defined and it is PR_AF_INET6 we set family - // to AF_INET6. + /* If _PR_INET6 is defined and it is PR_AF_INET6 we set family + * to AF_INET6. */ addrCopy = *addr; addrCopy.raw.family = AF_INET6; addrp = &addrCopy; #endif } #endif #ifdef _PR_HAVE_SOCKADDR_LEN - // if _PR_HAVE_SOCKADDR_LEN is defined and it is PR_AF_INET6 we set family - // to AF_INET6 and we set address length. + /* if _PR_HAVE_SOCKADDR_LEN is defined and it is PR_AF_INET6 we set family + * to AF_INET6 and we set address length. */ addrCopy = *addr; ((struct sockaddr*)&addrCopy)->sa_len = addr_len; ((struct sockaddr*)&addrCopy)->sa_family = md_af; addrp = &addrCopy; #endif #ifndef HAS_CONNECTX bytes = sendto( @@ -2138,21 +2139,22 @@ static PRInt32 pt_TCP_SendTo( op.event = POLLOUT | POLLPRI; bytes = pt_Continue(&op); syserrno = op.syserrno; } if (bytes < 0) { pt_MapError(_PR_MD_MAP_SENDTO_ERROR, syserrno); } return bytes; -#else +#else /* !HAS_CONNECTX */ PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); return -1; #endif } /* pt_TCP_SendTo */ +#endif /* LINUX || DARWIN */ static PRInt32 pt_RecvFrom(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRNetAddr *addr, PRIntervalTime timeout) { PRBool fNeedContinue = PR_FALSE; PRInt32 syserrno, bytes = -1; pt_SockLen addr_len = sizeof(PRNetAddr); @@ -3255,17 +3257,21 @@ static PRIOMethods _pr_tcp_methods = { pt_Connect, pt_Accept, pt_Bind, pt_Listen, pt_Shutdown, pt_Recv, pt_Send, (PRRecvfromFN)_PR_InvalidInt, - pt_TCP_SendTo, // This is for TCP Fast Open. Linux uses SendTo function for this. OSX uses connectx, but we imitate Linux. +#if defined(LINUX) || defined(DARWIN) + pt_TCP_SendTo, /* This is for TCP Fast Open. Linux uses SendTo function for this. OSX uses connectx, but we imitate Linux. */ +#else + (PRSendtoFN)_PR_InvalidInt, +#endif pt_Poll, pt_AcceptRead, pt_TransmitFile, pt_GetSockName, pt_GetPeerName, (PRReservedFN)_PR_InvalidInt, (PRReservedFN)_PR_InvalidInt, pt_GetSocketOption,