summaryrefslogtreecommitdiffstats
path: root/rpc/rpc-transport/socket
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2012-02-14 15:05:19 +0530
committerVijay Bellur <vijay@gluster.com>2012-02-20 00:46:27 -0800
commitc0b8e886cac4ef0f16d5f93adab02229bb1414cd (patch)
tree03f5bc6550d5f2501d5b968776f4bb0ee8025310 /rpc/rpc-transport/socket
parent975933a25d14cbac861e809b40c6edd01acaa28d (diff)
iobuf: use 'iobuf_get2()' to get variable sized buffers
added 'TODO' in places where it is missing. Change-Id: Ia802c94e3bb76930f7c88c990f078525be5459f5 Signed-off-by: Amar Tumballi <amar@gluster.com> BUG: 765264 Reviewed-on: http://review.gluster.com/388 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'rpc/rpc-transport/socket')
-rw-r--r--rpc/rpc-transport/socket/src/socket.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c
index 3b2d05c450b..120e193ddf1 100644
--- a/rpc/rpc-transport/socket/src/socket.c
+++ b/rpc/rpc-transport/socket/src/socket.c
@@ -823,6 +823,7 @@ __socket_read_vectored_request (rpc_transport_t *this, rpcsvc_vector_sizer vecto
struct iobuf *iobuf = NULL;
uint32_t remaining_size = 0;
ssize_t readsize = 0;
+ size_t size = 0;
GF_VALIDATE_OR_GOTO ("socket", this, out);
GF_VALIDATE_OR_GOTO ("socket", this->private, out);
@@ -907,7 +908,10 @@ sp_state_reading_proghdr:
case SP_STATE_READ_PROGHDR:
if (priv->incoming.payload_vector.iov_base == NULL) {
- iobuf = iobuf_get (this->ctx->iobuf_pool);
+
+ size = RPC_FRAGSIZE (priv->incoming.fraghdr) -
+ priv->incoming.frag.bytes_read;
+ iobuf = iobuf_get2 (this->ctx->iobuf_pool, size);
if (!iobuf) {
ret = -1;
break;
@@ -1048,6 +1052,7 @@ __socket_read_accepted_successful_reply (rpc_transport_t *this)
struct iobuf *iobuf = NULL;
uint32_t gluster_read_rsp_hdr_len = 0;
gfs3_read_rsp read_rsp = {0, };
+ size_t size = 0;
GF_VALIDATE_OR_GOTO ("socket", this, out);
GF_VALIDATE_OR_GOTO ("socket", this->private, out);
@@ -1080,7 +1085,11 @@ __socket_read_accepted_successful_reply (rpc_transport_t *this)
= SP_STATE_READ_PROC_HEADER;
if (priv->incoming.payload_vector.iov_base == NULL) {
- iobuf = iobuf_get (this->ctx->iobuf_pool);
+
+ size = (RPC_FRAGSIZE (priv->incoming.fraghdr) -
+ priv->incoming.frag.bytes_read);
+
+ iobuf = iobuf_get2 (this->ctx->iobuf_pool, size);
if (iobuf == NULL) {
ret = -1;
goto out;
@@ -1100,6 +1109,8 @@ __socket_read_accepted_successful_reply (rpc_transport_t *this)
priv->incoming.payload_vector.iov_base
= iobuf_ptr (iobuf);
+
+ priv->incoming.payload_vector.iov_len = size;
}
priv->incoming.frag.fragcurrent