Remove watch before closing connection.
[cascardo/rnetproxy.git] / hcconn.c
index adfa4c4..2297c94 100644 (file)
--- a/hcconn.c
+++ b/hcconn.c
@@ -135,8 +135,8 @@ hc_conn_write (HCConn *conn, char *buffer, size_t len)
 void
 hc_conn_close (HCConn *conn)
 {
-  conn->close (conn->layer);
   g_source_remove (conn->watch);
+  conn->close (conn->layer);
   g_io_channel_unref (conn->channel);
   g_slice_free (HCConn, conn);
 }