This is an automated email from the ASF dual-hosted git repository. jking pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/thrift.git
The following commit(s) were added to refs/heads/master by this push: new 7abb7d5 THRIFT-4671 handle client's unexpected close. 7abb7d5 is described below commit 7abb7d5fbc700db2338719bc88b7f4b10304942b Author: lixiasong <xiasong...@gmail.com> AuthorDate: Fri Nov 23 09:17:57 2018 +0800 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. --- lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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 @@ thrift_protocol_skip (ThriftProtocol *protocol, ThriftType type, GError **error) } case T_STRUCT: { - guint32 result = 0; + gint32 result = 0; gchar *name; gint16 fid; ThriftType ftype; @@ -475,6 +475,10 @@ thrift_protocol_skip (ThriftProtocol *protocol, ThriftType type, GError **error) { 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 @@ thrift_protocol_skip (ThriftProtocol *protocol, ThriftType type, GError **error) } 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 @@ thrift_protocol_skip (ThriftProtocol *protocol, ThriftType type, GError **error) } case T_MAP: { - guint32 result = 0; + gint32 result = 0; ThriftType elem_type; ThriftType key_type; guint32 i, size; @@ -517,7 +521,7 @@ thrift_protocol_skip (ThriftProtocol *protocol, ThriftType type, GError **error) } 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,