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

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

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

    https://github.com/apache/thrift/pull/1363#discussion_r139311583
  
    --- Diff: lib/cpp/src/thrift/transport/TSSLSocket.cpp ---
    @@ -759,7 +775,9 @@ unsigned int TSSLSocket::waitForEvent(bool wantRead) {
       struct THRIFT_POLLFD fds[2];
       memset(fds, 0, sizeof(fds));
       fds[0].fd = fdSocket;
    -  fds[0].events = wantRead ? THRIFT_POLLIN : THRIFT_POLLOUT;
    +  // use POLLIN also on write operations too, this is needed for operations
    +  // which requires read and write on the socket.
    --- End diff --
    
    hi jeking3,
    
    the comment may not be perfect, but SSL operations, like SSL_connect or 
SSL_shutdown (where this function is also used) need to perform write and read 
operations on the socket and we dont know where we are so we need to listen on 
both socket events.
    
    I could also introduce a new function parameter for that.


> C++: TSSLSockets bug in handling huge messages, bug in handling polling
> -----------------------------------------------------------------------
>
>                 Key: THRIFT-4331
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4331
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.10.0, 1.0
>            Reporter: Martin Haimberger
>             Fix For: 0.10.0, 1.0
>
>         Attachments: 0.10.0-THRIFT-4331.patch, master-THRIFT-4331.patch
>
>
> The TSSLSocket class did not handle large messages, because a underlying TCP 
> socket my signal bytes received, while SSL_read() may not have bytes 
> available. After maxretries (5) the function returned -1, which got 
> interpreted as unsigned integer for read bytes.
> Futher the waitForEvent methode, did only set THRIFT_POLLIN or 
> THRIFT_POLLOUT, but it gets used where SSL needs to send AND receive bytes 
> for some operations (like close). So in the case of write wanted, 
> THRIFT_POLLIN is also set to cover these read/write operations.
> Pullrequest for master and 0.10.0 branch will follow.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to