]> git.meshlink.io Git - catta/blobdiff - local.c
add prioq abstract data type
[catta] / local.c
diff --git a/local.c b/local.c
index 7204ca809f6a1e7f69b3acf58b2d7de0b1aac980..6c61fac405244ee52b3c568be001a8830272149c 100644 (file)
--- a/local.c
+++ b/local.c
@@ -42,14 +42,18 @@ static guint hash(gconstpointer v, guint l) {
 static guint addr_hash(gconstpointer v) {
     const flxAddress *a = v;
 
-    return hash(a, sizeof(a->family) + flx_address_get_size(a));
+    return hash(a->data, flx_address_get_size(a));
 }
 
 static void remove_addr(flxLocalAddrSource *l, const flxInterfaceAddress *a) {
+    flxAddress foo;
     g_assert(l);
     g_assert(a);
-    
-    g_hash_table_remove(l->hash_table, &a->address);
+
+    memset(&foo, 0, sizeof(foo));
+    foo.family = AF_INET;
+
+    g_hash_table_remove(l->hash_table, &foo); 
 }
 
 static void add_addr(flxLocalAddrSource *l, const flxInterfaceAddress *a) {
@@ -59,14 +63,14 @@ static void add_addr(flxLocalAddrSource *l, const flxInterfaceAddress *a) {
 
     if (g_hash_table_lookup(l->hash_table, &a->address))
         return; /* Entry already existant */
-    
+
     ai = g_new(addr_info, 1);
     ai->server = l->server;
     ai->address = a->address;
     
     ai->id = flx_server_get_next_id(l->server);
 
-    flx_server_add_address(l->server, ai->id, a->interface->index, l->hostname, &ai->address);
+    flx_server_add_address(l->server, ai->id, a->interface->index, AF_UNSPEC, l->hostname, &ai->address);
 
     g_hash_table_replace(l->hash_table, &ai->address, ai);
 }
@@ -152,9 +156,8 @@ flxLocalAddrSource *flx_local_addr_source_new(flxServer *s) {
     uname(&utsname);
     c = g_strdup_printf("%s%c%s%n", g_strup(utsname.machine), 0, g_strup(utsname.sysname), &length);
     
-    flx_server_add(l->server, l->hinfo_id, 0, l->hostname,
-                   FLX_DNS_TYPE_HINFO,
-                   c, length+1);
+    flx_server_add(l->server, l->hinfo_id, 0, AF_UNSPEC,
+                   l->hostname, FLX_DNS_TYPE_HINFO, c, length+1);
     g_free(c);
     
     return l;