[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r2213 - GNUnet/src/transports
From: |
durner |
Subject: |
[GNUnet-SVN] r2213 - GNUnet/src/transports |
Date: |
Wed, 26 Oct 2005 13:05:34 -0700 (PDT) |
Author: durner
Date: 2005-10-26 13:05:28 -0700 (Wed, 26 Oct 2005)
New Revision: 2213
Modified:
GNUnet/src/transports/http.c
GNUnet/src/transports/tcp.c
GNUnet/src/transports/tcp6.c
GNUnet/src/transports/udp.c
GNUnet/src/transports/udp6.c
Log:
Revert broken patch (revision 2211)
Modified: GNUnet/src/transports/http.c
===================================================================
--- GNUnet/src/transports/http.c 2005-10-26 19:14:49 UTC (rev 2212)
+++ GNUnet/src/transports/http.c 2005-10-26 20:05:28 UTC (rev 2213)
@@ -312,19 +312,6 @@
}
/**
- * Cron job to get IP address
- */
-static void getAddress(void *ip) {
- if (SYSERR == getPublicIPAddress(* ((IPaddr **) ip)))
- LOG(LOG_WARNING,
- _("Could not determine my public IP address.\n"));
- else
- LOG(LOG_DEBUG,
- "HTTP uses IP address %u.%u.%u.%u.\n",
- PRIP(ntohl(*(int*) *((IPaddr **) ip))));
-}
-
-/**
* Disconnect from a remote node. May only be called
* on sessions that were aquired by the caller first.
* For the core, aquiration means to call associate or
@@ -1096,7 +1083,6 @@
P2P_hello_MESSAGE * msg;
HostAddress * haddr;
unsigned short port;
- IPaddr **addr;
port = getGNUnetHTTPPort();
if (0 == port) {
@@ -1107,13 +1093,15 @@
msg = (P2P_hello_MESSAGE *) MALLOC(sizeof(P2P_hello_MESSAGE) +
sizeof(HostAddress));
haddr = (HostAddress*) &msg[1];
- /* Get address later, don't block startup by
- name resolution here */
- memset(&haddr->ip, 0, sizeof(IPaddr));
- addr = (IPaddr **) MALLOC(sizeof(IPaddr *));
- *addr = &haddr->ip;
- addCronJob(getAddress, 0, 0, (void *) addr);
-
+ if (SYSERR == getPublicIPAddress(&haddr->ip)) {
+ FREE(msg);
+ LOG(LOG_WARNING,
+ _("HTTP: Could not determine my public IP address.\n"));
+ return NULL;
+ }
+ LOG(LOG_DEBUG,
+ "HTTP uses IP address %u.%u.%u.%u.\n",
+ PRIP(ntohl(*(int*)&haddr->ip)));
haddr->port = htons(port);
haddr->reserved = htons(0);
msg->senderAddressSize = htons(sizeof(HostAddress));
Modified: GNUnet/src/transports/tcp.c
===================================================================
--- GNUnet/src/transports/tcp.c 2005-10-26 19:14:49 UTC (rev 2212)
+++ GNUnet/src/transports/tcp.c 2005-10-26 20:05:28 UTC (rev 2213)
@@ -264,19 +264,6 @@
}
/**
- * Cron job to get IP address
- */
-static void getAddress(void *ip) {
- if (SYSERR == getPublicIPAddress(* ((IPaddr **) ip)))
- LOG(LOG_WARNING,
- _("Could not determine my public IP address.\n"));
- else
- LOG(LOG_DEBUG,
- "TCP uses IP address %u.%u.%u.%u.\n",
- PRIP(ntohl(*(int*) *((IPaddr **) ip))));
-}
-
-/**
* Disconnect from a remote node. May only be called
* on sessions that were aquired by the caller first.
* For the core, aquiration means to call associate or
@@ -1075,7 +1062,6 @@
P2P_hello_MESSAGE * msg;
HostAddress * haddr;
unsigned short port;
- IPaddr **addr;
port = getGNUnetTCPPort();
if (0 == port) {
@@ -1090,12 +1076,15 @@
msg = (P2P_hello_MESSAGE *) MALLOC(sizeof(P2P_hello_MESSAGE) +
sizeof(HostAddress));
haddr = (HostAddress*) &msg[1];
- /* Get address later, don't block startup by
- name resolution here */
- memset(&haddr->ip, 0, sizeof(IPaddr));
- addr = (IPaddr **) MALLOC(sizeof(IPaddr *));
- *addr = &haddr->ip;
- addCronJob(getAddress, 0, 0, (void *) addr);
+ if (SYSERR == getPublicIPAddress(&haddr->ip)) {
+ FREE(msg);
+ LOG(LOG_WARNING,
+ _("Could not determine my public IP address.\n"));
+ return NULL;
+ }
+ LOG(LOG_DEBUG,
+ "TCP uses IP address %u.%u.%u.%u.\n",
+ PRIP(ntohl(*(int*)&haddr->ip)));
haddr->port = htons(port);
haddr->reserved = htons(0);
msg->senderAddressSize = htons(sizeof(HostAddress));
Modified: GNUnet/src/transports/tcp6.c
===================================================================
--- GNUnet/src/transports/tcp6.c 2005-10-26 19:14:49 UTC (rev 2212)
+++ GNUnet/src/transports/tcp6.c 2005-10-26 20:05:28 UTC (rev 2213)
@@ -248,15 +248,6 @@
}
/**
- * Cron job to get IP address
- */
-static void getAddress(void *ip) {
- if (SYSERR == getPublicIP6Address(*(IP6addr **)ip))
- LOG(LOG_WARNING,
- _("Could not determine my public IPv6 address.\n"));
-}
-
-/**
* Disconnect from a remote node. May only be called
* on sessions that were aquired by the caller first.
* For the core, aquiration means to call associate or
@@ -951,7 +942,6 @@
P2P_hello_MESSAGE * msg;
Host6Address * haddr;
unsigned short port;
- IP6addr **addr;
port = getGNUnetTCP6Port();
if (0 == port) {
@@ -962,12 +952,12 @@
msg = (P2P_hello_MESSAGE *) MALLOC(sizeof(P2P_hello_MESSAGE) +
sizeof(Host6Address));
haddr = (Host6Address*) &msg[1];
- /* Get address later, don't block startup by
- name resolution here */
- memset(&haddr->ip, 0, sizeof(IP6addr));
- addr = (IP6addr **) MALLOC(sizeof(IP6addr *));
- *addr = &haddr->ip;
- addCronJob(getAddress, 0, 0, (void *) addr);
+ if (SYSERR == getPublicIP6Address(&haddr->ip)) {
+ FREE(msg);
+ LOG(LOG_WARNING,
+ _("Could not determine my public IPv6 address.\n"));
+ return NULL;
+ }
haddr->port = htons(port);
haddr->reserved = htons(0);
msg->senderAddressSize = htons(sizeof(Host6Address));
Modified: GNUnet/src/transports/udp.c
===================================================================
--- GNUnet/src/transports/udp.c 2005-10-26 19:14:49 UTC (rev 2212)
+++ GNUnet/src/transports/udp.c 2005-10-26 20:05:28 UTC (rev 2213)
@@ -155,22 +155,6 @@
}
/**
- * Cron job to get IP address
- */
-/**
- * Cron job to get IP address
- */
-static void getAddress(void *ip) {
- if (SYSERR == getPublicIPAddress(* ((IPaddr **) ip)))
- LOG(LOG_WARNING,
- _("Could not determine my public IP address.\n"));
- else
- LOG(LOG_DEBUG,
- "UDP uses IP address %u.%u.%u.%u.\n",
- PRIP(ntohl(*(int*) *((IPaddr **) ip))));
-}
-
-/**
* Allocate and bind a server socket for the UDP transport.
*/
static int passivesock(unsigned short port) {
@@ -358,7 +342,6 @@
static P2P_hello_MESSAGE * createhello() {
P2P_hello_MESSAGE * msg;
HostAddress * haddr;
- IPaddr **addr;
if ( ( (udp_shutdown == YES) && (getGNUnetUDPPort() == 0) ) ||
( (udp_shutdown == NO) && (port == 0) ) )
@@ -367,13 +350,15 @@
msg = MALLOC(sizeof(P2P_hello_MESSAGE) + sizeof(HostAddress));
haddr = (HostAddress*) &msg[1];
- /* Get address later, don't block startup by
- name resolution here */
- memset(&haddr->senderIP, 0, sizeof(IPaddr));
- addr = (IPaddr **) MALLOC(sizeof(IPaddr *));
- *addr = &haddr->senderIP;
- addCronJob(getAddress, 0, 0, (void *) addr);
-
+ if (SYSERR == getPublicIPAddress(&haddr->senderIP)) {
+ FREE(msg);
+ LOG(LOG_WARNING,
+ _("UDP: Could not determine my public IP address.\n"));
+ return NULL;
+ }
+ LOG(LOG_DEBUG,
+ "UDP uses IP address %u.%u.%u.%u.\n",
+ PRIP(ntohl(*(int*)&haddr->senderIP)));
if (udp_shutdown == YES)
haddr->senderPort = htons(getGNUnetUDPPort());
else
Modified: GNUnet/src/transports/udp6.c
===================================================================
--- GNUnet/src/transports/udp6.c 2005-10-26 19:14:49 UTC (rev 2212)
+++ GNUnet/src/transports/udp6.c 2005-10-26 20:05:28 UTC (rev 2213)
@@ -183,15 +183,6 @@
}
/**
- * Cron job to get IP address
- */
-static void getAddress(void *ip) {
- if (SYSERR == getPublicIP6Address(*(IP6addr **)ip))
- LOG(LOG_WARNING,
- _("Could not determine my public IPv6 address.\n"));
-}
-
-/**
* Listen on the given socket and distribute the packets to the UDP6
* handler.
*/
@@ -348,7 +339,6 @@
P2P_hello_MESSAGE * msg;
Host6Address * haddr;
unsigned short port;
- IP6addr **addr;
port = getGNUnetUDP6Port();
if (port == 0)
@@ -357,13 +347,12 @@
msg = MALLOC(sizeof(P2P_hello_MESSAGE) + sizeof(Host6Address));
haddr = (Host6Address*) &msg[1];
- /* Get address later, don't block startup by
- name resolution here */
- memset(&haddr->senderIP, 0, sizeof(IP6addr));
- addr = (IP6addr **) MALLOC(sizeof(IP6addr *));
- *addr = &haddr->senderIP;
- addCronJob(getAddress, 0, 0, (void *) addr);
-
+ if (SYSERR == getPublicIP6Address(&haddr->senderIP)) {
+ FREE(msg);
+ LOG(LOG_WARNING,
+ _("UDP6: Could not determine my public IPv6 address.\n"));
+ return NULL;
+ }
haddr->senderPort = htons(port);
haddr->reserved = htons(0);
msg->senderAddressSize = htons(sizeof(Host6Address));
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r2213 - GNUnet/src/transports,
durner <=