THRIFT-4671 handle client's unexpected close.
handle client's unexpected close. Avoid the server work thread falling into dead loop because :
1. the function return result from INT32 coverts to UINT32 ;
2. the condition in line 482 "ftype == T_STOP" will never be satisfied when the client socket closed before sending data to server.
diff --git a/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol.c b/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol.c
index 1433725..8296a8c 100644
--- a/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol.c
+++ b/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol.c
@@ -465,7 +465,7 @@
}
case T_STRUCT:
{
- guint32 result = 0;
+ gint32 result = 0;
gchar *name;
gint16 fid;
ThriftType ftype;
@@ -475,6 +475,10 @@
{
result += thrift_protocol_read_field_begin (protocol, &name, &ftype,
&fid, error);
+ if (result < 0)
+ {
+ return result;
+ }
if (ftype == T_STOP)
{
break;
@@ -487,7 +491,7 @@
}
case T_SET:
{
- guint32 result = 0;
+ gint32 result = 0;
ThriftType elem_type;
guint32 i, size;
result += thrift_protocol_read_set_begin (protocol, &elem_type, &size,
@@ -501,7 +505,7 @@
}
case T_MAP:
{
- guint32 result = 0;
+ gint32 result = 0;
ThriftType elem_type;
ThriftType key_type;
guint32 i, size;
@@ -517,7 +521,7 @@
}
case T_LIST:
{
- guint32 result = 0;
+ gint32 result = 0;
ThriftType elem_type;
guint32 i, size;
result += thrift_protocol_read_list_begin (protocol, &elem_type, &size,