Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 3CC69200C7E for ; Tue, 9 May 2017 01:35:13 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 3B564160BC7; Mon, 8 May 2017 23:35:13 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 81BC7160BA5 for ; Tue, 9 May 2017 01:35:12 +0200 (CEST) Received: (qmail 93257 invoked by uid 500); 8 May 2017 23:35:11 -0000 Mailing-List: contact dev-help@drill.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@drill.apache.org Delivered-To: mailing list dev@drill.apache.org Received: (qmail 93108 invoked by uid 99); 8 May 2017 23:35:11 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 May 2017 23:35:11 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 2C3F3DFAB4; Mon, 8 May 2017 23:35:11 +0000 (UTC) From: bitblender To: dev@drill.apache.org Reply-To: dev@drill.apache.org References: In-Reply-To: Subject: [GitHub] drill pull request #809: Drill-4335: C++ client changes for supporting encry... Content-Type: text/plain Message-Id: <20170508233511.2C3F3DFAB4@git1-us-west.apache.org> Date: Mon, 8 May 2017 23:35:11 +0000 (UTC) archived-at: Mon, 08 May 2017 23:35:13 -0000 Github user bitblender commented on a diff in the pull request: https://github.com/apache/drill/pull/809#discussion_r114818140 --- Diff: contrib/native/client/src/clientlib/drillClientImpl.cpp --- @@ -854,75 +990,328 @@ void DrillClientImpl::waitForResults(){ } } -status_t DrillClientImpl::readMsg(ByteBuf_t _buf, - AllocatedBufferPtr* allocatedBuffer, +/* + * Decode the length of the message from bufWithLen and then read entire message from the socket. + * Parameters: + * bufWithLen - in param - buffer containing the bytes which has length of the RPC message/encrypted chunk + * bufferWithLenBytes - out param - buffer pointer which points to memory allocated in this function and has the + * entire one RPC message / encrypted chunk along with the length of the message + * lengthBytesLength - out param - bytes of bufWithLen which contains the length of the entire RPC message or + * encrypted chunk + * lengthDecodeHandler - in param - function pointer with length decoder to use. For encrypted chunk we use + * lengthDecode and for plain RPC message we use rpcLengthDecode. + * Return: + * status_t - QRY_SUCCESS - In case of success. + * - QRY_COMM_ERROR/QRY_INTERNAL_ERROR/QRY_CLIENT_OUTOFMEM - In cases of error. + */ +status_t DrillClientImpl::readLenBytesFromSocket(ByteBuf_t bufWithLen, AllocatedBufferPtr* bufferWithLenBytes, + uint32_t& lengthBytesLength, lengthDecoder lengthDecodeHandler) { + + uint32_t rmsgLen = 0; + size_t bytes_read = 0; + size_t leftover = 0; + boost::system::error_code error; + *bufferWithLenBytes = NULL; + size_t bufferWithLenBytesSize = 0; + + bytes_read = (this->*lengthDecodeHandler)(bufWithLen, rmsgLen); --- End diff -- What does it mean to access a local using the 'this' ptr? Can't this be written as bytes_read = (lengthDecodeHandler)(bufWithLen, rmsgLen); ? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---