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

Ben Craig commented on THRIFT-1870:
-----------------------------------

I understand that client code should have as few ifdefs as possible.  I'm not 
sure how this change improves the state of client code.

TPipe.h typedefed TPipe to TSocket on *nix systems, and TPipeServer.h typedefed 
TPipeServer to TServerSocket on *nix.  Those typedefs made it so that client 
code could use the string constructor of "TPipe" and get a reasonable, named 
localhost transport, without client typedefs.

What my changes in THRIFT-1690 broke was using *nix anonymous pipes through 
TPipe.  This change doesn't seem to address that.

I don't see how the ptrdiff_t changes improve calling code portability.  
Portable calling code won't be using the ptrdiff_t constructor, or the get / 
set pipe handle functions, as those currently only apply to Windows named 
pipes.  Constructing the HANDLE, or using the get / set pipe handle functions 
in a meaningful way requires clients to write platform specific code anyway.  
That constructor and those methods are there as an "escape hatch" to allow 
client code to access APIs that Thrift hasn't abstracted yet.

Is there a different part of the patch that deals with anonymous unix pipes 
that didn't make it here?  I could see how supporting anonymous pipes in the 
future would motivate the ptrdiff_t changes.  However, using ptrdiff_t will 
cause problems on 64-bit linux, as you will be truncating a 64-bit user value 
into a 32-bit file descriptor, and that will cause warnings without a bunch of 
casting.  If you want to make anonymous Unix pipes work through TPipe, then you 
need a typedef that is HANDLE on Windows, and int on *nix.
                
> Enhance TPipe / TPipeServer transport to support both Windows 64-bit and 
> cross-platform *NIX support
> ----------------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-1870
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1870
>             Project: Thrift
>          Issue Type: Improvement
>    Affects Versions: 0.9
>         Environment: Windows, *NIX
>            Reporter: Peace C
>             Fix For: 0.9
>
>         Attachments: TPipe_64bit_xplatform.patch
>
>
> This patch adds support for Windows 64-bit builds by using std::ptrdiff_t to 
> represent Windows' pipe HANDLE. It also restores cross-platform *NIX support 
> that was broken in THRIFT-1690.
> See contrib/transport-sample for a working cross-platform example of how to 
> use TPipe[Server]. I tested all permutations of Win32/64-bit clients with 
> Win32/64-bit servers and they were happy. Also tested successfully on OSX.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to