mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 08:12:05 +00:00
Fix for bug 121952 -- make PR_ConnectContinue work on Mac, re-enabling non-blocking connects. r=wtc. Also bring forward some code changes to build with CodeWarrior Pro 7 (UPP stuff).
This commit is contained in:
parent
d3ee9b756c
commit
855f941a23
@ -115,15 +115,18 @@ typedef struct _MDSocketCallerInfo {
|
||||
|
||||
struct _MDFileDesc {
|
||||
PRInt32 osfd;
|
||||
PRBool orderlyDisconnect;
|
||||
PRBool readReady;
|
||||
PRBool writeReady;
|
||||
PRBool exceptReady;
|
||||
PRPackedBool orderlyDisconnect;
|
||||
PRPackedBool readReady;
|
||||
PRPackedBool writeReady;
|
||||
PRPackedBool exceptReady;
|
||||
PRLock * miscLock;
|
||||
|
||||
/* Server sockets: listen bit tells the notifier func what to do */
|
||||
PRBool doListen;
|
||||
|
||||
/* stored error for non-blocking connects, as a Unix-style error code */
|
||||
OTReason disconnectError;
|
||||
|
||||
_MDSocketCallerInfo misc;
|
||||
_MDSocketCallerInfo read;
|
||||
_MDSocketCallerInfo write;
|
||||
@ -647,7 +650,7 @@ extern PRStatus _MD_CloseFileMap(struct PRFileMap *fmap);
|
||||
#define _MD_CLOSE_FILE_MAP _MD_CloseFileMap
|
||||
|
||||
extern void SetLogFileTypeCreator(const char *logFile);
|
||||
extern int _MD_mac_get_nonblocking_connect_error(PRInt32 osfd);
|
||||
extern int _MD_mac_get_nonblocking_connect_error(PRFileDesc* fd);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -347,7 +347,7 @@ static PRStatus PR_CALLBACK SocketConnectContinue(
|
||||
|
||||
#elif defined(XP_MAC)
|
||||
|
||||
err = _MD_mac_get_nonblocking_connect_error(osfd);
|
||||
err = _MD_mac_get_nonblocking_connect_error(fd);
|
||||
if (err == -1)
|
||||
return PR_FAILURE;
|
||||
else
|
||||
|
@ -267,7 +267,7 @@ PRInt32 ReadWriteProc(PRFileDesc *fd, void *buf, PRUint32 bytes, IOOperation op)
|
||||
a 32 byte Ptr in the heap, so only do this once
|
||||
*/
|
||||
if (!sCompletionUPP)
|
||||
sCompletionUPP = NewIOCompletionProc((IOCompletionProcPtr)&AsyncIOCompletion);
|
||||
sCompletionUPP = NewIOCompletionUPP((IOCompletionProcPtr)&AsyncIOCompletion);
|
||||
|
||||
/* grab the thread so we know which one to post to at completion */
|
||||
pbAsync.thread = me;
|
||||
|
@ -373,6 +373,8 @@ static pascal void NotifierRoutine(void * contextPtr, OTEventCode code, OTResul
|
||||
PR_ASSERT(err == kOTNoError);
|
||||
secret->md.exceptReady = PR_TRUE; // XXX Check this
|
||||
|
||||
md->disconnectError = discon.reason; // save for _MD_mac_get_nonblocking_connect_error
|
||||
|
||||
// wake up waiting threads, if any
|
||||
result = -3199 - discon.reason; // obtain the negative error code
|
||||
if ((readThread = secret->md.read.thread) != NULL) {
|
||||
@ -2197,25 +2199,32 @@ ErrorExit:
|
||||
}
|
||||
|
||||
|
||||
int _MD_mac_get_nonblocking_connect_error(PRInt32 osfd)
|
||||
int _MD_mac_get_nonblocking_connect_error(PRFileDesc* fd)
|
||||
{
|
||||
OTResult resultOT;
|
||||
EndpointRef endpoint = (EndpointRef) osfd;
|
||||
EndpointRef endpoint = (EndpointRef)fd->secret->md.osfd;
|
||||
OTResult resultOT = OTGetEndpointState(endpoint);
|
||||
|
||||
resultOT = OTGetEndpointState(endpoint);
|
||||
switch (resultOT) {
|
||||
case T_OUTCON:
|
||||
macsock_map_error(EINPROGRESS);
|
||||
return -1;
|
||||
|
||||
case T_DATAXFER:
|
||||
return 0;
|
||||
|
||||
case T_IDLE:
|
||||
macsock_map_error(fd->secret->md.disconnectError);
|
||||
fd->secret->md.disconnectError = 0;
|
||||
return -1;
|
||||
|
||||
case T_INREL:
|
||||
macsock_map_error(ENOTCONN);
|
||||
return -1;
|
||||
|
||||
default:
|
||||
PR_ASSERT(0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return -1; // not reached
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ void _MD_StartInterrupts(void)
|
||||
gPrimaryThread = _PR_MD_CURRENT_THREAD();
|
||||
|
||||
if ( !gTimerCallbackUPP )
|
||||
gTimerCallbackUPP = NewTimerProc(TimerCallback);
|
||||
gTimerCallbackUPP = NewTimerUPP(TimerCallback);
|
||||
|
||||
// Fill in the Time Manager queue element
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user