[ 
https://issues.apache.org/jira/browse/THRIFT-3437?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15021747#comment-15021747
 ] 

ASF GitHub Bot commented on THRIFT-3437:
----------------------------------------

Github user becrux commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/628#discussion_r45580255
  
    --- Diff: lib/cpp/src/thrift/server/TNonblockingServer.cpp ---
    @@ -1105,10 +1113,17 @@ void TNonblockingServer::listenSocket(THRIFT_SOCKET 
s) {
       serverSocket_ = s;
     
       if (!port_) {
    -    sockaddr_in addr;
    -    socklen_t size = sizeof(addr);
    -    if (!getsockname(serverSocket_, reinterpret_cast<sockaddr*>(&addr), 
&size)) {
    -      listenPort_ = ntohs(addr.sin_port);
    +    #ifdef _WIN32
    +      struct sockaddr_storage addr;
    +      struct sockaddr_in *pAddr = (sockaddr_in *) &addr;
    +      socklen_t size = sizeof(addr);
    +    #else
    +      struct sockaddr_in addr;
    +      struct sockaddr_in *pAddr = &addr;
    +      socklen_t size = sizeof(addr);
    +    #endif
    --- End diff --
    
    Well, I do not have an answer, but it seems an official Windows API, cause 
all "stackoverflow" posts I found are not related to MinGW usage. Even if you 
search through different blogs & forums, you'll find the same answer, and MinGW 
is not mentioned.
    
    Moreover, sample code reported in MSDN documentation comments uses 
getsockname in the same way:
    
    
https://msdn.microsoft.com/en-us/library/windows/desktop/ms738543(v=vs.85).aspx


> Mingw-w64 build fail
> --------------------
>
>                 Key: THRIFT-3437
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3437
>             Project: Thrift
>          Issue Type: Bug
>          Components: Build Process
>    Affects Versions: 0.9.3
>         Environment: Windows XP/7/8/10
>            Reporter: Antonio Di Monaco
>              Labels: patch
>
> When building Thrift code under MinGW-w64, I got a compilation failure, due 
> to the following problems:
> - Missing ws2_32 library link in CMakeLists.txt file
> - conflict with boost/tr1/functional.hpp, when using BOOST_THREAD
> - AI_ADDRCONFIG missing when Win32 version lower than 0x0600
> - Missing __MINGW32__ define
> Tests fail due to getsockname due to:
> - different Win32 getsockname behavior
> - BOOST_TEST_DYN_LINK not supported
> - Q_MOC_RUN / Boost conflict during build
> - mkstemp not supported (cause _mktemp_s should be used)
> Solved with pull request "Fixed MinGW-w64 build && boost/functional conflict 
> #628"



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to