[pisa-src] r1785 - in trunk/pisacd: cdconf.c cdconfhandlers.c cdservers.c cdservers.h

  • From: Thomas Jansen <mithi@xxxxxxxxx>
  • To: pisa-src@xxxxxxxxxxxxx
  • Date: Wed, 25 Nov 2009 16:27:17 +0100

Author: tjansen
Date: Wed Nov 25 16:27:16 2009
New Revision: 1785

Log:
Removed wrapper function pisa_server_add.

It was called twice and did slightly different things in both cases.

Modified:
   trunk/pisacd/cdconf.c
   trunk/pisacd/cdconfhandlers.c
   trunk/pisacd/cdservers.c
   trunk/pisacd/cdservers.h

Modified: trunk/pisacd/cdconf.c
==============================================================================
--- trunk/pisacd/cdconf.c       Wed Nov 25 16:14:19 2009        (r1784)
+++ trunk/pisacd/cdconf.c       Wed Nov 25 16:27:16 2009        (r1785)
@@ -17,7 +17,7 @@
 #include "cdconf.h"
 #include "libpisa/util.h"
 #include "cdctx.h"
-#include "cdservers.h"
+#include "cdregister.h"
 
 #define PISACD_DEFAULT_IDLE_DISCONNECT_DELAY   600
 #define PISACD_DEFAULT_DEBUGLEVEL              "all"
@@ -200,6 +200,7 @@
 {
        char hit[INET6_ADDRSTRLEN];
        struct in6_addr addr;
+       pisa_conmgr_entry *entry;
 
        if (!pisa_cfg_get_string_value("trustpoint", hit, sizeof(hit))) {
                PISA_ERROR("No trustpoint specified.\n");
@@ -211,7 +212,8 @@
                return;
        }
 
-       pisa_server_add(&addr, PISACD_DEFAULT_PORTNUM_CONTROL, 
PISA_CONTYPE_RELAY);
+       entry = pisa_conmgr_add(cd_ctx.conlist, &addr, 
PISACD_DEFAULT_PORTNUM_CONTROL, PISA_CONTYPE_RELAY);
+       pisa_client_connect_to_server(entry);
 }
 
 /**

Modified: trunk/pisacd/cdconfhandlers.c
==============================================================================
--- trunk/pisacd/cdconfhandlers.c       Wed Nov 25 16:14:19 2009        (r1784)
+++ trunk/pisacd/cdconfhandlers.c       Wed Nov 25 16:27:16 2009        (r1785)
@@ -38,7 +38,7 @@
        assert(packet);
        serveradd = &packet->body.request.rdata.serveradd;
 
-       entry = pisa_server_add(&serveradd->hit, 
PISACD_DEFAULT_PORTNUM_CONTROL, serveradd->type);
+       entry = pisa_conmgr_add(cd_ctx.conlist, &serveradd->hit, 
PISACD_DEFAULT_PORTNUM_CONTROL, serveradd->type);
 
        if (!entry)
                PISA_ERROR("Failed to handle a server add request.\n");

Modified: trunk/pisacd/cdservers.c
==============================================================================
--- trunk/pisacd/cdservers.c    Wed Nov 25 16:14:19 2009        (r1784)
+++ trunk/pisacd/cdservers.c    Wed Nov 25 16:27:16 2009        (r1785)
@@ -18,7 +18,6 @@
 
 #include "cdconf.h"
 #include "cdctx.h"
-#include "cdregister.h"
 #include "cdservers.h"
 #include "libpisa/nat.h"
 
@@ -27,25 +26,6 @@
 #define PISA_LOCAL_IP_TO_SERVICE_SUFFIX "pisa"
 
 /**
- * Add a server connection if it passes sanity checks. If it is a relay type
- * connection, connect to it immediately. Otherwise keep it in the
- * disconnected state and wait for a request to activate the connection.
- * @param hit HIT of the server
- * @param port control port of the server
- * @param type connection type
- */
-pisa_conmgr_entry *pisa_server_add(struct in6_addr *hit, int port, 
pisa_contype type)
-{
-       pisa_conmgr_entry *entry = NULL;
-
-       entry = pisa_conmgr_add(cd_ctx.conlist, hit, port, type);
-       if (type == PISA_CONTYPE_RELAY)
-               pisa_client_connect_to_server(entry);
-
-       return entry;
-}
-
-/**
  * Generate a domain name for looking up a virtual local IP.
  *
  * @param addr virtual local IP address

Modified: trunk/pisacd/cdservers.h
==============================================================================
--- trunk/pisacd/cdservers.h    Wed Nov 25 16:14:19 2009        (r1784)
+++ trunk/pisacd/cdservers.h    Wed Nov 25 16:27:16 2009        (r1785)
@@ -7,11 +7,8 @@
 #define PISA_CDSERVERS_H
 
 #include <netinet/in.h>
-#include "libpisa/conmgr.h"
 #include "libpisa/nat.h"
 
-pisa_conmgr_entry *pisa_server_add(struct in6_addr *hit, int port, 
pisa_contype type);
-
 pisa_nat_mapping *pisa_servers_add_via_dns(struct in_addr *local_ip);
 
 #endif /* PISA_CDSERVERS_H */

Other related posts:

  • » [pisa-src] r1785 - in trunk/pisacd: cdconf.c cdconfhandlers.c cdservers.c cdservers.h - Thomas Jansen