зеркало из https://github.com/mozilla/gecko-dev.git
Bug 134099: Worked around two BeOS bugs. 1. connect does not implicitly
bind the socket. 2. accept does not return the peer's address. Modified files: _beos.h prsocket.c bnet.c
This commit is contained in:
Родитель
ea6c773a85
Коммит
394af917c2
|
@ -91,6 +91,7 @@
|
|||
#define _PR_HAVE_PEEK_BUFFER
|
||||
#define _PR_PEEK_BUFFER_MAX (16 * 1024)
|
||||
#define _PR_FD_NEED_EMULATE_MSG_PEEK(fd) 1
|
||||
#define _PR_CONNECT_DOES_NOT_BIND
|
||||
|
||||
/* Define threading functions and objects as native BeOS */
|
||||
struct _MDThread {
|
||||
|
|
|
@ -1516,6 +1516,17 @@ failed:
|
|||
if (f[0] == NULL) {
|
||||
goto failed;
|
||||
}
|
||||
#ifdef _PR_CONNECT_DOES_NOT_BIND
|
||||
/*
|
||||
* If connect does not implicitly bind the socket (e.g., on
|
||||
* BeOS), we have to bind the socket so that we can get its
|
||||
* port with getsockname later.
|
||||
*/
|
||||
PR_InitializeNetAddr(PR_IpAddrLoopback, 0, &selfAddr);
|
||||
if (PR_Bind(f[0], &selfAddr) == PR_FAILURE) {
|
||||
goto failed;
|
||||
}
|
||||
#endif
|
||||
PR_InitializeNetAddr(PR_IpAddrLoopback, port, &selfAddr);
|
||||
|
||||
/*
|
||||
|
|
|
@ -491,6 +491,9 @@ _MD_accept (PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen,
|
|||
}
|
||||
if (rv < 0) {
|
||||
_PR_MD_MAP_ACCEPT_ERROR(err);
|
||||
} else if (addr != NULL) {
|
||||
/* bug 134099 */
|
||||
err = getpeername(rv, (struct sockaddr *) addr, (_PRSockLen_t *)addrlen);
|
||||
}
|
||||
done:
|
||||
#ifdef _PR_HAVE_SOCKADDR_LEN
|
||||
|
@ -498,9 +501,6 @@ done:
|
|||
/* Mask off the first byte of struct sockaddr (the length field) */
|
||||
if (addr) {
|
||||
addr->raw.family = ((struct sockaddr *) addr)->sa_family;
|
||||
#ifdef IS_LITTLE_ENDIAN
|
||||
addr->raw.family = ntohs(addr->raw.family);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif /* _PR_HAVE_SOCKADDR_LEN */
|
||||
|
|
Загрузка…
Ссылка в новой задаче