Change from GNet to HCConn.
[cascardo/rnetproxy.git] / null.c
diff --git a/null.c b/null.c
index fd4de84..1ad81c9 100644 (file)
--- a/null.c
+++ b/null.c
@@ -18,7 +18,6 @@
 **  
 */
 
-#include <gnet.h>
 #include <glib.h>
 #include "null.h"
 
@@ -31,9 +30,9 @@ static void null_close (net_hook_t* hook)
   if (hook->peer)
     {
       hook->peer->peer = NULL;
-      gnet_conn_disconnect (hook->peer->conn);
+      hc_conn_close (hook->peer->conn);
     }
-  gnet_conn_delete (hook->conn);
+  hc_conn_close (hook->conn);
   g_slice_free (net_hook_t, hook);
 }
 
@@ -43,7 +42,7 @@ static void null_write (net_hook_t* hook)
 
 static void null_read (net_hook_t* hook, gchar* buffer, size_t len)
 {
-  gnet_conn_write (hook->peer->conn, buffer, len);
+  hc_conn_write (hook->peer->conn, buffer, len);
 }
 
 static void null_error (net_hook_t* hook)
@@ -55,7 +54,6 @@ static net_hook_t* null_server_hook_new (net_hook_t* client_hook, char *server)
 {
   net_hook_t* hook;
   hook = g_slice_new (net_hook_t);
-  hook->conn = gnet_conn_new (server, 110, nethook_event, hook);
   hook->peer = client_hook;
   hook->server = TRUE;
   hook->connect = null_connect;
@@ -63,12 +61,11 @@ static net_hook_t* null_server_hook_new (net_hook_t* client_hook, char *server)
   hook->write = null_write;
   hook->read = null_read;
   hook->data = NULL;
-  gnet_conn_connect (hook->conn);
-  gnet_conn_read (hook->conn);
+  hook->conn = hc_conn_new (hc_tcp_connect (server, "110"), nethook_event, hook);
   return hook;
 }
 
-net_hook_t* null_hook_new (GConn* conn, char *server)
+net_hook_t* null_hook_new (HCConn* conn, char *server)
 {
   net_hook_t* hook;
   hook = g_slice_new (net_hook_t);
@@ -81,7 +78,7 @@ net_hook_t* null_hook_new (GConn* conn, char *server)
   hook->read = null_read;
   hook->data = server;
   hook->peer = null_server_hook_new (hook, server);
-  gnet_conn_set_callback (hook->conn, nethook_event, hook);
+  hc_conn_set_callback (hook->conn, nethook_event, hook);
   return hook;
 }