Github user gadLinux commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/1200#discussion_r102329070
  
    --- Diff: 
lib/c_glib/src/thrift/c_glib/protocol/thrift_multiplexed_protocol.c ---
    @@ -42,146 +41,119 @@ static GParamSpec 
*thrift_multiplexed_protocol_obj_properties[PROP_THRIFT_MULTIP
     
     gint32
     thrift_multiplexed_protocol_write_message_begin (ThriftMultiplexedProtocol 
*protocol,
    -           const gchar *name, const ThriftMessageType message_type,
    -           const gint32 seqid, GError **error)
    +    const gchar *name, const ThriftMessageType message_type,
    +    const gint32 seqid, GError **error)
     {
    -   gint32 ret;
    -   gchar *service_name = NULL;
    -   g_return_val_if_fail (THRIFT_IS_MULTIPLEXED_PROTOCOL (protocol), -1);
    +  gint32 ret;
    +  gchar *service_name = NULL;
    +  g_return_val_if_fail (THRIFT_IS_MULTIPLEXED_PROTOCOL (protocol), -1);
     
    -   ThriftMultiplexedProtocol *self = THRIFT_MULTIPLEXED_PROTOCOL 
(protocol);
    -   ThriftMultiplexedProtocolClass *multiplexClass = 
THRIFT_MULTIPLEXED_PROTOCOL_GET_CLASS(self);
    -   ThriftProtocolClass *cls = THRIFT_PROTOCOL_CLASS (multiplexClass);
    +  ThriftMultiplexedProtocol *self = THRIFT_MULTIPLEXED_PROTOCOL (protocol);
    +  ThriftMultiplexedProtocolClass *multiplexClass = 
THRIFT_MULTIPLEXED_PROTOCOL_GET_CLASS(self);
    +  ThriftProtocolClass *cls = THRIFT_PROTOCOL_CLASS (multiplexClass);
     
    -   if( (message_type == T_CALL || message_type == T_ONEWAY) && 
self->service_name != NULL) {
    -           service_name = g_strdup_printf("%s%s%s", self->service_name, 
self->separator, name);
    +  if( (message_type == T_CALL || message_type == T_ONEWAY) && 
self->service_name != NULL) {
    +    service_name = g_strdup_printf("%s%s%s", self->service_name, 
THRIFT_MULTIPLEXED_PROTOCOL_DEFAULT_SEPARATOR, name);
    +  }else{
    +    service_name = g_strdup(name);
    +  }
     
    -   }else{
    -           service_name = g_strdup(name);
    -   }
    +  // relay to the protocol_decorator
    +  ret = thrift_protocol_decorator_write_message_begin(protocol, 
service_name, message_type, seqid, error);
     
    -   // relay to the protocol_decorator
    -   ret = thrift_protocol_decorator_write_message_begin(protocol, 
service_name, message_type, seqid, error);
    +  g_free(service_name);
     
    -   g_free(service_name);
    -
    -   return ret;
    +  return ret;
     }
     
     
    -
    -
     static void
     thrift_multiplexed_protocol_set_property (GObject      *object,
    -           guint         property_id,
    -           const GValue *value,
    -           GParamSpec   *pspec)
    +    guint         property_id,
    +    const GValue *value,
    +    GParamSpec   *pspec)
     {
    -   ThriftMultiplexedProtocol *self = THRIFT_MULTIPLEXED_PROTOCOL (object);
    -
    -   switch (property_id)
    -   {
    -   case PROP_THRIFT_MULTIPLEXED_PROTOCOL_SERVICE_NAME:
    -           if(self->service_name!=NULL)
    -                   g_free (self->service_name);
    -           self->service_name= g_value_dup_string (value);
    -           break;
    -
    -   case PROP_THRIFT_MULTIPLEXED_PROTOCOL_SEPARATOR:
    --- End diff --
    
    Suppose a protocol or transport that add a separator to the packet to, for 
example, add a header of encryption. And the separator is the same. It may be 
confused because found twice, once for the protocol and another for the 
multiplexed. Changing the multiplexed separator will fix the possible issue. 


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to