diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-04-28 07:38:20 +0200 |
---|---|---|
committer | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-04-28 07:38:20 +0200 |
commit | 6b2bba06b433fb75979ab6daf7bbe8bc76c53875 (patch) | |
tree | 75803b4683889e6e0d2a3faef30415db3ff7b3ba /nsprpub/pr/src/io | |
parent | 72def35cd0cf3649b6d7ab72b66117df3e1c33fc (diff) | |
parent | c75dae3ed21bfa5a8ae46cd83d18329af5bea05a (diff) | |
download | UXP-6b2bba06b433fb75979ab6daf7bbe8bc76c53875.tar UXP-6b2bba06b433fb75979ab6daf7bbe8bc76c53875.tar.gz UXP-6b2bba06b433fb75979ab6daf7bbe8bc76c53875.tar.lz UXP-6b2bba06b433fb75979ab6daf7bbe8bc76c53875.tar.xz UXP-6b2bba06b433fb75979ab6daf7bbe8bc76c53875.zip |
Merge branch 'master' of https://github.com/MoonchildProductions/UXP into pm_url_1
Diffstat (limited to 'nsprpub/pr/src/io')
-rw-r--r-- | nsprpub/pr/src/io/prio.c | 71 | ||||
-rw-r--r-- | nsprpub/pr/src/io/prsocket.c | 68 |
2 files changed, 0 insertions, 139 deletions
diff --git a/nsprpub/pr/src/io/prio.c b/nsprpub/pr/src/io/prio.c index 10ae5e098..bf9763a2c 100644 --- a/nsprpub/pr/src/io/prio.c +++ b/nsprpub/pr/src/io/prio.c @@ -137,82 +137,11 @@ PR_IMPLEMENT(void) PR_FreeFileDesc(PRFileDesc *fd) _PR_Putfd(fd); } -#if defined(_WIN64) && defined(WIN95) - -PRFileDescList *_fd_waiting_for_overlapped_done = NULL; -PRLock *_fd_waiting_for_overlapped_done_lock = NULL; - -void CheckOverlappedPendingSocketsAreDone() -{ - if (!_fd_waiting_for_overlapped_done_lock || - !_fd_waiting_for_overlapped_done) { - return; - } - - PR_Lock(_fd_waiting_for_overlapped_done_lock); - - PRFileDescList *cur = _fd_waiting_for_overlapped_done; - PRFileDescList *previous = NULL; - while (cur) { - PR_ASSERT(cur->fd->secret->overlappedActive); - PRFileDesc *fd = cur->fd; - DWORD rvSent; - if (GetOverlappedResult((HANDLE)fd->secret->md.osfd, &fd->secret->ol, &rvSent, FALSE) == TRUE) { - fd->secret->overlappedActive = PR_FALSE; - PR_LOG(_pr_io_lm, PR_LOG_MIN, - ("CheckOverlappedPendingSocketsAreDone GetOverlappedResult succeeded\n")); - } else { - DWORD err = WSAGetLastError(); - PR_LOG(_pr_io_lm, PR_LOG_MIN, - ("CheckOverlappedPendingSocketsAreDone GetOverlappedResult failed %d\n", err)); - if (err != ERROR_IO_INCOMPLETE) { - fd->secret->overlappedActive = PR_FALSE; - } - } - - if (!fd->secret->overlappedActive) { - - _PR_MD_CLOSE_SOCKET(fd->secret->md.osfd); - fd->secret->state = _PR_FILEDESC_CLOSED; -#ifdef _PR_HAVE_PEEK_BUFFER - if (fd->secret->peekBuffer) { - PR_ASSERT(fd->secret->peekBufSize > 0); - PR_DELETE(fd->secret->peekBuffer); - fd->secret->peekBufSize = 0; - fd->secret->peekBytes = 0; - } -#endif - - PR_FreeFileDesc(fd); - - if (previous) { - previous->next = cur->next; - } else { - _fd_waiting_for_overlapped_done = cur->next; - } - PRFileDescList *del = cur; - cur = cur->next; - PR_Free(del); - } else { - previous = cur; - cur = cur->next; - } - } - - PR_Unlock(_fd_waiting_for_overlapped_done_lock); -} -#endif - /* ** Wait for some i/o to finish on one or more more poll descriptors. */ PR_IMPLEMENT(PRInt32) PR_Poll(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout) { -#if defined(_WIN64) && defined(WIN95) - // For each iteration check if TFO overlapped IOs are down. - CheckOverlappedPendingSocketsAreDone(); -#endif - return(_PR_MD_PR_POLL(pds, npds, timeout)); } diff --git a/nsprpub/pr/src/io/prsocket.c b/nsprpub/pr/src/io/prsocket.c index 26f7a245d..a24b8e1bb 100644 --- a/nsprpub/pr/src/io/prsocket.c +++ b/nsprpub/pr/src/io/prsocket.c @@ -304,25 +304,7 @@ static PRStatus PR_CALLBACK SocketConnectContinue( if (err != 0) { _PR_MD_MAP_CONNECT_ERROR(err); } else { -#if defined(_WIN64) - if (fd->secret->overlappedActive) { - PRInt32 rvSent; - if (GetOverlappedResult(osfd, &fd->secret->ol, &rvSent, FALSE) == FALSE) { - err = WSAGetLastError(); - PR_LOG(_pr_io_lm, PR_LOG_MIN, - ("SocketConnectContinue GetOverlappedResult failed %d\n", err)); - if (err != ERROR_IO_INCOMPLETE) { - _PR_MD_MAP_CONNECT_ERROR(err); - fd->secret->overlappedActive = PR_FALSE; - } - } - } - if (err == 0) { - PR_SetError(PR_UNKNOWN_ERROR, 0); - } -#else PR_SetError(PR_UNKNOWN_ERROR, 0); -#endif } return PR_FAILURE; } @@ -737,56 +719,6 @@ static PRStatus PR_CALLBACK SocketClose(PRFileDesc *fd) } if (fd->secret->state == _PR_FILEDESC_OPEN) { -#if defined(_WIN64) && defined(WIN95) - /* TCP Fast Open on Windows must use ConnectEx, which uses overlapped - * input/output. Before closing such a socket we must cancelIO. - */ - if (fd->secret->overlappedActive) { - PR_ASSERT(fd->secret->nonblocking); - if (CancelIo((HANDLE) fd->secret->md.osfd) == TRUE) { - PR_LOG(_pr_io_lm, PR_LOG_MIN, - ("SocketClose - CancelIo succeeded\n")); - } else { - DWORD err = WSAGetLastError(); - PR_LOG(_pr_io_lm, PR_LOG_MIN, - ("SocketClose - CancelIo failed err=%x\n", err)); - } - - DWORD rvSent; - if (GetOverlappedResult((HANDLE)fd->secret->md.osfd, &fd->secret->ol, &rvSent, FALSE) == TRUE) { - fd->secret->overlappedActive = PR_FALSE; - PR_LOG(_pr_io_lm, PR_LOG_MIN, - ("SocketClose GetOverlappedResult succeeded\n")); - } else { - DWORD err = WSAGetLastError(); - PR_LOG(_pr_io_lm, PR_LOG_MIN, - ("SocketClose GetOverlappedResult failed %d\n", err)); - if (err != ERROR_IO_INCOMPLETE) { - _PR_MD_MAP_CONNECT_ERROR(err); - fd->secret->overlappedActive = PR_FALSE; - } - } - } - - if (fd->secret->overlappedActive && - _fd_waiting_for_overlapped_done_lock) { - // Put osfd into the list to be checked later. - PRFileDescList *forWaiting = PR_NEW(PRFileDescList); - if (!forWaiting) { - PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0); - return PR_FAILURE; - } - forWaiting->fd = fd; - - PR_Lock(_fd_waiting_for_overlapped_done_lock); - forWaiting->next = _fd_waiting_for_overlapped_done; - _fd_waiting_for_overlapped_done = forWaiting; - PR_Unlock(_fd_waiting_for_overlapped_done_lock); - - return PR_SUCCESS; - } -#endif - if (_PR_MD_CLOSE_SOCKET(fd->secret->md.osfd) < 0) { return PR_FAILURE; } |