THRIFT-1140. glib_c: Framed Transport Client using C (Glib) Library hangs when connec...
authorBryan Duxbury <bryanduxbury@apache.org>
Thu, 9 Jun 2011 00:21:55 +0000 (00:21 +0000)
committerBryan Duxbury <bryanduxbury@apache.org>
Thu, 9 Jun 2011 00:21:55 +0000 (00:21 +0000)
Include the size of the whole buffer.

Patch: Lukas Fittl

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1133611 13f79535-47bb-0310-9956-ffa450edef68

lib/c_glib/src/transport/thrift_framed_transport.c

index c8dd446..2bed0a1 100644 (file)
@@ -81,7 +81,7 @@ thrift_framed_transport_read_frame (ThriftTransport *transport,
   guchar tmpdata[sz];
   bytes = THRIFT_TRANSPORT_GET_CLASS (t->transport)->read (t->transport,
                                                            tmpdata,
-                                                           sz - sizeof (sz),
+                                                           sz,
                                                            error);
 
   /* add the data to the buffer */
@@ -205,7 +205,7 @@ thrift_framed_transport_flush (ThriftTransport *transport, GError **error)
 
   // get the size of the frame in host and network byte order
   sz_hbo = t->w_buf->len + sizeof(sz_nbo);
-  sz_nbo = (gint32) htonl ((guint32) sz_hbo);
+  sz_nbo = (gint32) htonl ((guint32) t->w_buf->len);
 
   // copy the size of the frame and then the frame itself
   guchar tmpdata[sz_hbo];