Hi, I have submitted a patch for review:
https://gerrit.libreoffice.org/1975 To pull it, you can do: git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/75/1975/1 Remove specific socket code for Linux Change-Id: I8b51f7027a6c55544ebbbcc9c76bea0913856cc6 --- M sal/osl/unx/pipe.c M sal/osl/unx/socket.c M sal/osl/unx/sockimpl.h 3 files changed, 0 insertions(+), 134 deletions(-) diff --git a/sal/osl/unx/pipe.c b/sal/osl/unx/pipe.c index f0720ec..a61a022 100644 --- a/sal/osl/unx/pipe.c +++ b/sal/osl/unx/pipe.c @@ -109,10 +109,6 @@ pPipeImpl = (oslPipe)calloc(1, sizeof(struct oslPipeImpl)); pPipeImpl->m_nRefCount =1; pPipeImpl->m_bClosed = sal_False; -#if defined(LINUX) - pPipeImpl->m_bIsInShutdown = sal_False; - pPipeImpl->m_bIsAccepting = sal_False; -#endif return pPipeImpl; } @@ -366,11 +362,6 @@ void SAL_CALL osl_closePipe( oslPipe pPipe ) { int nRet; -#if defined(LINUX) - size_t len; - struct sockaddr_un addr; - int fd; -#endif int ConnFD; if( ! pPipe ) @@ -384,34 +375,6 @@ } ConnFD = pPipe->m_Socket; - - /* - Thread does not return from accept on linux, so - connect to the accepting pipe - */ -#if defined(LINUX) - if ( pPipe->m_bIsAccepting ) - { - pPipe->m_bIsInShutdown = sal_True; - pPipe->m_Socket = -1; - fd = socket(AF_UNIX, SOCK_STREAM, 0); - memset(&addr, 0, sizeof(addr)); - - OSL_TRACE("osl_destroyPipe : Pipe Name '%s'",pPipe->m_Name); - - addr.sun_family = AF_UNIX; - strncpy(addr.sun_path, pPipe->m_Name, sizeof(addr.sun_path) - 1); - len = sizeof(addr); - - nRet = connect( fd, (struct sockaddr *)&addr, len); - if ( nRet < 0 ) - { - OSL_TRACE("connect in osl_destroyPipe failed with error: %s", strerror(errno)); - } - close(fd); - } -#endif /* LINUX */ - nRet = shutdown(ConnFD, 2); if ( nRet < 0 ) @@ -451,15 +414,8 @@ OSL_ASSERT(strlen(pPipe->m_Name) > 0); -#if defined(LINUX) - pPipe->m_bIsAccepting = sal_True; -#endif - s = accept(pPipe->m_Socket, NULL, NULL); -#if defined(LINUX) - pPipe->m_bIsAccepting = sal_False; -#endif if (s < 0) { @@ -467,13 +423,6 @@ return NULL; } -#if defined(LINUX) - if ( pPipe->m_bIsInShutdown ) - { - close(s); - return NULL; - } -#endif /* LINUX */ else { /* alloc memory */ diff --git a/sal/osl/unx/socket.c b/sal/osl/unx/socket.c index a9f3fc0..9e75710 100644 --- a/sal/osl/unx/socket.c +++ b/sal/osl/unx/socket.c @@ -471,10 +471,6 @@ pSocket->m_nLastError = 0; pSocket->m_nRefCount = 1; -#if defined(LINUX) - pSocket->m_bIsAccepting = sal_False; -#endif - #if OSL_DEBUG_LEVEL > 1 g_nSocketImpl ++; #endif @@ -1478,13 +1474,6 @@ { if( pSocket && 0 == osl_atomic_decrement( &(pSocket->m_nRefCount) ) ) { -#if defined(LINUX) - if ( pSocket->m_bIsAccepting == sal_True ) - { - OSL_FAIL("osl_destroySocket : attempt to destroy socket while accepting\n"); - return; - } -#endif /* LINUX */ osl_closeSocket( pSocket ); __osl_destroySocketImpl( pSocket ); } @@ -1511,48 +1500,6 @@ return; pSocket->m_Socket = OSL_INVALID_SOCKET; - -#if defined(LINUX) - pSocket->m_bIsInShutdown = sal_True; - - if ( pSocket->m_bIsAccepting == sal_True ) - { - int nConnFD; - union { - struct sockaddr aSockAddr; - struct sockaddr_in aSockAddrIn; - } s; - socklen_t nSockLen = sizeof(s.aSockAddr); - - nRet = getsockname(nFD, &s.aSockAddr, &nSockLen); - if ( nRet < 0 ) - { - OSL_TRACE("getsockname call failed with error: %s", strerror(errno)); - } - - if ( s.aSockAddr.sa_family == AF_INET ) - { - if ( s.aSockAddrIn.sin_addr.s_addr == htonl(INADDR_ANY) ) - { - s.aSockAddrIn.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - } - - nConnFD = socket(AF_INET, SOCK_STREAM, 0); - if ( nConnFD < 0 ) - { - OSL_TRACE("socket call failed with error: %s", strerror(errno)); - } - - nRet = connect(nConnFD, &s.aSockAddr, sizeof(s.aSockAddr)); - if ( nRet < 0 ) - { - OSL_TRACE("connect call failed with error: %s", strerror(errno)); - } - close(nConnFD); - } - pSocket->m_bIsAccepting = sal_False; - } -#endif /* LINUX */ nRet=close(nFD); if ( nRet != 0 ) @@ -1827,9 +1774,6 @@ } pSocket->m_nLastError=0; -#if defined(LINUX) - pSocket->m_bIsAccepting = sal_True; -#endif /* LINUX */ if( ppAddr && *ppAddr ) { @@ -1850,24 +1794,10 @@ pSocket->m_nLastError=errno; OSL_TRACE("osl_acceptConnectionOnSocket : accept error '%s'",strerror(errno)); -#if defined(LINUX) - pSocket->m_bIsAccepting = sal_False; -#endif /* LINUX */ return 0; } OSL_ASSERT(AddrLen == sizeof(struct sockaddr)); - - -#if defined(LINUX) - if ( pSocket->m_bIsInShutdown == sal_True ) - { - close(Connection); - OSL_TRACE("osl_acceptConnectionOnSocket : close while accept"); - return 0; - } -#endif /* LINUX */ - if(ppAddr) { @@ -1893,11 +1823,6 @@ pConnectionSockImpl->m_Socket = Connection; pConnectionSockImpl->m_nLastError = 0; -#if defined(LINUX) - pConnectionSockImpl->m_bIsAccepting = sal_False; - - pSocket->m_bIsAccepting = sal_False; -#endif /* LINUX */ return pConnectionSockImpl; } diff --git a/sal/osl/unx/sockimpl.h b/sal/osl/unx/sockimpl.h index cfcd1a4..b35827e 100644 --- a/sal/osl/unx/sockimpl.h +++ b/sal/osl/unx/sockimpl.h @@ -32,10 +32,6 @@ int m_Socket; int m_nLastError; oslInterlockedCount m_nRefCount; -#if defined(LINUX) - sal_Bool m_bIsAccepting; - sal_Bool m_bIsInShutdown; -#endif }; struct oslSocketAddrImpl @@ -49,10 +45,6 @@ sal_Char m_Name[PATH_MAX + 1]; oslInterlockedCount m_nRefCount; sal_Bool m_bClosed; -#if defined(LINUX) - sal_Bool m_bIsAccepting; - sal_Bool m_bIsInShutdown; -#endif }; oslSocket __osl_createSocketImpl(int Socket); -- To view, visit https://gerrit.libreoffice.org/1975 To unsubscribe, visit https://gerrit.libreoffice.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8b51f7027a6c55544ebbbcc9c76bea0913856cc6 Gerrit-PatchSet: 1 Gerrit-Project: core Gerrit-Branch: master Gerrit-Owner: Arnaud Versini <arnaud.vers...@gmail.com> _______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice