pseudotcp: Add socket state to debug messages
authorPhilip Withnall <philip.withnall@collabora.co.uk>
Tue, 5 Aug 2014 16:39:01 +0000 (17:39 +0100)
committerOlivier CrĂȘte <olivier.crete@collabora.com>
Thu, 21 Aug 2014 18:33:11 +0000 (14:33 -0400)
This should make debugging a little clearer.

agent/pseudotcp.c

index 9da7bcb..3455557 100644 (file)
@@ -520,14 +520,15 @@ static void resize_send_buffer (PseudoTcpSocket *self, guint32 new_size);
 static void resize_receive_buffer (PseudoTcpSocket *self, guint32 new_size);
 static void set_state (PseudoTcpSocket *self, PseudoTcpState new_state);
 
+static const gchar *pseudo_tcp_state_get_name (PseudoTcpState state);
 
 // The following logging is for detailed (packet-level) pseudotcp analysis only.
 static PseudoTcpDebugLevel debug_level = PSEUDO_TCP_DEBUG_NONE;
 
 #define DEBUG(level, fmt, ...)                                          \
   if (debug_level >= level)                                             \
-    g_log (level == PSEUDO_TCP_DEBUG_NORMAL ? "libnice-pseudotcp" : "libnice-pseudotcp-verbose", G_LOG_LEVEL_DEBUG, "PseudoTcpSocket %p: " fmt, \
-        self, ## __VA_ARGS__)
+    g_log (level == PSEUDO_TCP_DEBUG_NORMAL ? "libnice-pseudotcp" : "libnice-pseudotcp-verbose", G_LOG_LEVEL_DEBUG, "PseudoTcpSocket %p %s: " fmt, \
+        self, pseudo_tcp_state_get_name (self->priv->state), ## __VA_ARGS__)
 
 void
 pseudo_tcp_set_debug_level (PseudoTcpDebugLevel level)