[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r21286 - gnunet/src/transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r21286 - gnunet/src/transport |
Date: |
Sun, 6 May 2012 13:53:15 +0200 |
Author: grothoff
Date: 2012-05-06 13:53:15 +0200 (Sun, 06 May 2012)
New Revision: 21286
Modified:
gnunet/src/transport/gnunet-service-transport_clients.c
gnunet/src/transport/gnunet-transport.c
gnunet/src/transport/plugin_transport_http.c
gnunet/src/transport/plugin_transport_tcp.c
gnunet/src/transport/plugin_transport_udp.c
gnunet/src/transport/plugin_transport_unix.c
gnunet/src/transport/transport_api_address_to_string.c
Log:
-fixing #2302
Modified: gnunet/src/transport/gnunet-service-transport_clients.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_clients.c 2012-05-06
01:12:57 UTC (rev 21285)
+++ gnunet/src/transport/gnunet-service-transport_clients.c 2012-05-06
11:53:15 UTC (rev 21286)
@@ -775,10 +775,6 @@
return;
}
GNUNET_SERVER_disable_receive_done_warning (client);
- if ((NULL == address) || (0 == address_len))
- {
- GNUNET_break_op (0);
- }
papi->address_pretty_printer (papi->cls, plugin_name, address, address_len,
numeric, rtimeout, &transmit_address_to_client,
tc);
Modified: gnunet/src/transport/gnunet-transport.c
===================================================================
--- gnunet/src/transport/gnunet-transport.c 2012-05-06 01:12:57 UTC (rev
21285)
+++ gnunet/src/transport/gnunet-transport.c 2012-05-06 11:53:15 UTC (rev
21286)
@@ -454,7 +454,8 @@
int printed;
};
-void
+
+static void
process_string (void *cls, const char *address)
{
struct ResolutionContext *rc = cls;
Modified: gnunet/src/transport/plugin_transport_http.c
===================================================================
--- gnunet/src/transport/plugin_transport_http.c 2012-05-06 01:12:57 UTC
(rev 21285)
+++ gnunet/src/transport/plugin_transport_http.c 2012-05-06 11:53:15 UTC
(rev 21286)
@@ -212,6 +212,12 @@
sbs = sizeof (struct sockaddr_in);
port = ntohs (a4->u4_port);
}
+ else if (0 == addrlen)
+ {
+ asc (asc_cls, "<inbound connection>");
+ asc (asc_cls, NULL);
+ return;
+ }
else
{
/* invalid address */
Modified: gnunet/src/transport/plugin_transport_tcp.c
===================================================================
--- gnunet/src/transport/plugin_transport_tcp.c 2012-05-06 01:12:57 UTC (rev
21285)
+++ gnunet/src/transport/plugin_transport_tcp.c 2012-05-06 11:53:15 UTC (rev
21286)
@@ -1507,11 +1507,15 @@
sb = &a4;
sbs = sizeof (a4);
}
+ else if (0 == addrlen)
+ {
+ asc (asc_cls, "<inbound connection>");
+ asc (asc_cls, NULL);
+ return;
+ }
else
{
/* invalid address */
- GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, "tcp",
- "Invalid address to string request: plugin `%s', address length: %u
bytes\n");
GNUNET_break_op (0);
asc (asc_cls, NULL);
return;
Modified: gnunet/src/transport/plugin_transport_udp.c
===================================================================
--- gnunet/src/transport/plugin_transport_udp.c 2012-05-06 01:12:57 UTC (rev
21285)
+++ gnunet/src/transport/plugin_transport_udp.c 2012-05-06 11:53:15 UTC (rev
21286)
@@ -514,6 +514,12 @@
sb = &a4;
sbs = sizeof (a4);
}
+ else if (0 == addrlen)
+ {
+ asc (asc_cls, "<inbound connection>");
+ asc (asc_cls, NULL);
+ return;
+ }
else
{
/* invalid address */
Modified: gnunet/src/transport/plugin_transport_unix.c
===================================================================
--- gnunet/src/transport/plugin_transport_unix.c 2012-05-06 01:12:57 UTC
(rev 21285)
+++ gnunet/src/transport/plugin_transport_unix.c 2012-05-06 11:53:15 UTC
(rev 21286)
@@ -185,12 +185,7 @@
*/
struct GNUNET_TRANSPORT_PluginEnvironment *env;
- /*
- * Session of peers with whom we are currently connected
- */
- struct PeerSession *sessions;
-
- /*
+ /**
* Sessions
*/
struct GNUNET_CONTAINER_MultiHashMap *session_map;
@@ -243,9 +238,11 @@
unsigned int bytes_in_queue;
};
+
static void
unix_plugin_select (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+
static void
reschedule_select (struct Plugin * plugin)
{
@@ -320,6 +317,7 @@
return GNUNET_YES;
}
+
/**
* Disconnect from a remote node. Clean up session if we have one for this
peer
*
@@ -327,7 +325,7 @@
* @param target the peeridentity of the peer to disconnect
* @return GNUNET_OK on success, GNUNET_SYSERR if the operation failed
*/
-void
+static void
unix_disconnect (void *cls, const struct GNUNET_PeerIdentity *target)
{
struct Plugin *plugin = cls;
@@ -379,23 +377,6 @@
}
-struct PeerSession *
-find_session (struct Plugin *plugin, const struct GNUNET_PeerIdentity *peer)
-{
- struct PeerSession *pos;
-
- pos = plugin->sessions;
- while (pos != NULL)
- {
- if (memcmp (&pos->target, peer, sizeof (struct GNUNET_PeerIdentity)) == 0)
- return pos;
- pos = pos->next;
- }
-
- return pos;
-}
-
-
/**
* Actually send out the message, assume we've got the address and
* send_handle squared away!
@@ -563,6 +544,7 @@
struct Session *res;
};
+
static int
get_session_it (void *cls, const GNUNET_HashCode * key, void *value)
{
@@ -824,6 +806,7 @@
}
}
+
static void
unix_plugin_select_write (struct Plugin * plugin)
{
@@ -891,14 +874,14 @@
}
-/*
- * @param cls the plugin handle
- * @param tc the scheduling context (for rescheduling this function again)
- *
+
+/**
* We have been notified that our writeset has something to read. We don't
* know which socket needs to be read, so we have to check each one
* Then reschedule this function to be called again once more is available.
*
+ * @param cls the plugin handle
+ * @param tc the scheduling context (for rescheduling this function again)
*/
static void
unix_plugin_select (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
@@ -929,12 +912,13 @@
reschedule_select (plugin);
}
+
/**
* Create a slew of UNIX sockets. If possible, use IPv6 and IPv4.
*
* @param cls closure for server start, should be a struct Plugin *
* @return number of sockets created or GNUNET_SYSERR on error
-*/
+ */
static int
unix_transport_server_start (void *cls)
{
@@ -1041,16 +1025,19 @@
GNUNET_TRANSPORT_AddressStringCallback asc,
void *asc_cls)
{
- if ((addr != NULL) && (addrlen > 0))
+ if ((NULL != addr) && (addrlen > 0))
+ {
asc (asc_cls, (const char *) addr);
+ }
else
{
GNUNET_break (0);
- asc (asc_cls, "Invalid UNIX address");
+ asc (asc_cls, "<invalid UNIX address>");
}
-
+ asc (asc_cls, NULL);
}
+
/**
* Function called to convert a string address to
* a binary address.
@@ -1063,11 +1050,11 @@
* @param added length of created address
* @return GNUNET_OK on success, GNUNET_SYSERR on failure
*/
-int
+static int
unix_string_to_address (void *cls, const char *addr, uint16_t addrlen,
void **buf, size_t *added)
{
- if ((NULL == addr) || (addrlen == 0))
+ if ((NULL == addr) || (0 == addrlen))
{
GNUNET_break (0);
return GNUNET_SYSERR;
@@ -1091,8 +1078,6 @@
}
-
-
/**
* Function called for a quick conversion of the binary address to
* a numeric address. Note that the caller must not free the
@@ -1109,10 +1094,10 @@
{
if ((addr != NULL) && (addrlen > 0))
return (const char *) addr;
- else
- return NULL;
+ return NULL;
}
+
/**
* Notify transport service about address
*
Modified: gnunet/src/transport/transport_api_address_to_string.c
===================================================================
--- gnunet/src/transport/transport_api_address_to_string.c 2012-05-06
01:12:57 UTC (rev 21285)
+++ gnunet/src/transport/transport_api_address_to_string.c 2012-05-06
11:53:15 UTC (rev 21286)
@@ -141,9 +141,8 @@
GNUNET_break (0);
return NULL;
}
-
client = GNUNET_CLIENT_connect ("transport", cfg);
- if (client == NULL)
+ if (NULL == client)
return NULL;
msg = GNUNET_malloc (len);
msg->header.size = htons (len);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r21286 - gnunet/src/transport,
gnunet <=