Skip to content

Commit

Permalink
UPGRADE_NSPR_RELEASE This is a temporary change to the nspr code in m…
Browse files Browse the repository at this point in the history
…ozilla-central. We believe we have identified a fix to TCP Fast open feature crashes. We would like to verify the fix before making changes in nspr and investing time in doing a proper fix in nspr. The issue has been discussed over e-mails and this push is justifiable before commiitting changes to nspr. Overwriting this push by a new nspr release will not break mozilla-central it will only disable the TCP fast open feature. Patch has been reviewed in bug 1384633. r=mcmanus r=:kaie: r=mayhemer a=jduell a=mcmanus
  • Loading branch information
ddragana committed Aug 10, 2017
1 parent 201dd4a commit 77398bc
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
13 changes: 13 additions & 0 deletions nsprpub/pr/include/private/pprio.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,19 @@ NSPR_API(PRStatus) PR_NT_CancelIo(PRFileDesc *fd);

#endif /* WIN32 */

/* FUNCTION: PR_FileDesc2PlatformOverlappedIOHandle
** DESCRIPTION:
** This functionality is only available on windows. Some windows operation use
** asynchronous (call overlapped) io. One of them is ConnectEx. NSPR uses
** ConnectEx for enabling TCP Fast Open.
** This function returns an OVERLAPPED structure associated with ConnectEx call.
** If ConnectEx has not been called or the io has already finished, the
** function will return PR_INVALID_ARGUMENT_ERROR.
** PRFileDesc continues to be owner of the structure and the structure must not
** be destroyed.
*/
NSPR_API(PRStatus) PR_FileDesc2PlatformOverlappedIOHandle(PRFileDesc *fd, void **ol);

PR_END_EXTERN_C

#endif /* pprio_h___ */
27 changes: 27 additions & 0 deletions nsprpub/pr/src/io/prsocket.c
Original file line number Diff line number Diff line change
Expand Up @@ -1666,6 +1666,33 @@ PR_ChangeFileDescNativeHandle(PRFileDesc *fd, PROsfd handle)
fd->secret->md.osfd = handle;
}

/* Expose OVERLAPPED if present. OVERLAPPED is implemented only on WIN95. */
PR_IMPLEMENT(PRStatus)
PR_FileDesc2PlatformOverlappedIOHandle(PRFileDesc *fd, void **ol)
{
#if defined(_WIN64) && defined(WIN95)
*ol = NULL;
if (fd) {
fd = PR_GetIdentitiesLayer(fd, PR_NSPR_IO_LAYER);
}
if (!fd) {
PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
return PR_FAILURE;
}

if (!fd->secret->overlappedActive) {
PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
return PR_FAILURE;
}

*ol = &fd->secret->ol;
return PR_SUCCESS;
#else
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
return PR_FAILURE;
#endif
}

/*
** Select compatibility
**
Expand Down
4 changes: 4 additions & 0 deletions nsprpub/pr/src/nspr.def
Original file line number Diff line number Diff line change
Expand Up @@ -462,3 +462,7 @@ EXPORTS ;-
PR_DuplicateEnvironment;
PR_GetEnvSecure;
;+} NSPR_4.10.3;
;+NSPR_4.16 {
;+ global:
PR_FileDesc2PlatformOverlappedIOHandle;
;+} NSPR_4.15;
8 changes: 8 additions & 0 deletions nsprpub/pr/src/pthreads/ptio.c
Original file line number Diff line number Diff line change
Expand Up @@ -4744,6 +4744,14 @@ PR_IMPLEMENT(PRInt32) PR_FileDesc2NativeHandle(PRFileDesc *bottom)
return osfd;
} /* PR_FileDesc2NativeHandle */

/* Expose OVERLAPPED if present. OVERLAPPED is implemented only on WIN95. */
PR_IMPLEMENT(PRStatus)
PR_FileDesc2PlatformOverlappedIOHandle(PRFileDesc *fd, void **ol)
{
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
return PR_FAILURE;
}

PR_IMPLEMENT(void) PR_ChangeFileDescNativeHandle(PRFileDesc *fd,
PRInt32 handle)
{
Expand Down

0 comments on commit 77398bc

Please sign in to comment.