Separate iochannel implementation from HCConn interface.
[cascardo/rnetproxy.git] / null.c
diff --git a/null.c b/null.c
index 1ad81c9..a543af8 100644 (file)
--- a/null.c
+++ b/null.c
@@ -36,10 +36,6 @@ static void null_close (net_hook_t* hook)
   g_slice_free (net_hook_t, hook);
 }
 
-static void null_write (net_hook_t* hook)
-{
-}
-
 static void null_read (net_hook_t* hook, gchar* buffer, size_t len)
 {
   hc_conn_write (hook->peer->conn, buffer, len);
@@ -53,15 +49,17 @@ static void null_error (net_hook_t* hook)
 static net_hook_t* null_server_hook_new (net_hook_t* client_hook, char *server)
 {
   net_hook_t* hook;
+  int fd;
   hook = g_slice_new (net_hook_t);
   hook->peer = client_hook;
   hook->server = TRUE;
   hook->connect = null_connect;
   hook->close = null_close;
-  hook->write = null_write;
   hook->read = null_read;
   hook->data = NULL;
-  hook->conn = hc_conn_new (hc_tcp_connect (server, "110"), nethook_event, hook);
+  hook->conn = hc_conn_new (nethook_event, hook);
+  fd = hc_tcp_connect (server, "110");
+  hc_conn_set_driver_channel (hook->conn, fd);
   return hook;
 }
 
@@ -74,7 +72,6 @@ net_hook_t* null_hook_new (HCConn* conn, char *server)
   hook->server = FALSE;
   hook->connect = null_connect;
   hook->close = null_close;
-  hook->write = null_write;
   hook->read = null_read;
   hook->data = server;
   hook->peer = null_server_hook_new (hook, server);