text[size] = '\n';
text[size + 1] = '\0';
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client: %X - %s", cls, text);
+#if BUILD_HTTPS
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-https", "Client: %X - %s", cls, text);
+#else
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-http", "Client: %X - %s", cls, text);
+#endif
}
return 0;
}
client_send (struct Session *s, struct HTTP_Message *msg)
{
GNUNET_CONTAINER_DLL_insert (s->msg_head, s->msg_tail, msg);
+ if (s != NULL)
+ curl_easy_pause(s->client_put, CURLPAUSE_CONT);
return GNUNET_OK;
}
{
#if DEBUG_HTTP
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
- "Connection to '%s' %s ended\n", GNUNET_i2s(&s->target), GNUNET_a2s (s->addr, s->addrlen));
+ "Client: %X connection to '%s' %s ended\n", s, GNUNET_i2s(&s->target), GNUNET_a2s (s->addr, s->addrlen));
#endif
client_disconnect(s);
//GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,"Notifying about ended session to peer `%s' `%s'\n", GNUNET_i2s (&s->target), http_plugin_address_to_string (plugin, s->addr, s->addrlen));
#if DEBUG_HTTP
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
- "Client: Deleting outbound PUT session to peer `%s'\n",
+ "Client: %X Deleting outbound PUT session to peer `%s'\n",
+ s,
GNUNET_i2s (&s->target));
#endif
#if DEBUG_HTTP
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
- "Client: Deleting outbound GET session to peer `%s'\n",
+ "Client: %X Deleting outbound GET session to peer `%s'\n",
+ s,
GNUNET_i2s (&s->target));
#endif
+ if (s->recv_wakeup_task != GNUNET_SCHEDULER_NO_TASK)
+ {
+ GNUNET_SCHEDULER_cancel (s->recv_wakeup_task);
+ s->recv_wakeup_task = GNUNET_SCHEDULER_NO_TASK;
+ }
if (s->client_get != NULL)
{
#endif
}
}
+static void
+client_wake_up (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+ struct Session *s = cls;
+
+ s->recv_wakeup_task = GNUNET_SCHEDULER_NO_TASK;
+ if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
+ return;
+
+ if (s->client_get != NULL)
+ curl_easy_pause(s->client_get, CURLPAUSE_CONT);
+}
/**
* Callback method used with libcurl
{
struct Session *s = cls;
struct Plugin *plugin = s->plugin;
+ struct GNUNET_TIME_Absolute now;
#if VERBOSE_CLIENT
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, "Client: Received %Zu bytes from peer `%s'\n",
GNUNET_i2s (&s->target));
#endif
- if (GNUNET_TIME_absolute_get().abs_value < s->delay.abs_value)
+ now = GNUNET_TIME_absolute_get();
+ if (now.abs_value < s->delay.abs_value)
{
#if DEBUG_CLIENT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "no inbound bandwidth available! Next read was delayed for %llu ms\n",
+ "No inbound bandwidth available! Next read was delayed for %llu ms\n",
s, GNUNET_TIME_absolute_get_difference(s->delay, GNUNET_TIME_absolute_get()).rel_value);
#endif
- return 0;
+ if (s->recv_wakeup_task != GNUNET_SCHEDULER_NO_TASK)
+ {
+ GNUNET_SCHEDULER_cancel (s->recv_wakeup_task);
+ s->recv_wakeup_task = GNUNET_SCHEDULER_NO_TASK;
+ }
+ s->recv_wakeup_task = GNUNET_SCHEDULER_add_delayed( GNUNET_TIME_absolute_get_difference(s->delay, now), &client_wake_up, s);
+ return CURLPAUSE_ALL;
}
client_send_cb (void *stream, size_t size, size_t nmemb, void *cls)
{
struct Session *s = cls;
- //struct Plugin *plugin = s->plugin;
+ struct Plugin *plugin = s->plugin;
size_t bytes_sent = 0;
size_t len;
if (msg->pos == msg->size)
{
#if VERBOSE_CLIENT
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Message with %u bytes sent, removing message from queue\n",
- s, msg->pos);
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
+ "Client: %X Message with %u bytes sent, removing message from queue\n",
+ s, msg->size, msg->pos);
#endif
/* Calling transmit continuation */
if (NULL != msg->transmit_cont)
plugin->last_tag++;
/* create url */
GNUNET_asprintf (&url, "%s%s;%u", http_plugin_address_to_string (plugin, s->addr, s->addrlen), GNUNET_h2s_full (&plugin->env->my_identity->hashPubKey),plugin->last_tag);
- //GNUNET_asprintf (&url, "http://www.heise.de", http_plugin_address_to_string (plugin, s->addr, s->addrlen), GNUNET_h2s_full (&plugin->env->my_identity->hashPubKey),plugin->last_tag);
#if 0
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
"URL `%s'\n",
*/
#define LEARNED_ADDRESS_EXPIRATION GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 6)
-/**
- * Network format for IPv4 addresses.
- */
-struct IPv4HttpAddress
-{
- /**
- * IPv4 address, in network byte order.
- */
- uint32_t ipv4_addr GNUNET_PACKED;
-
- /**
- * Port number, in network byte order.
- */
- uint16_t port GNUNET_PACKED;
-};
-
/**
* Wrapper to manage IPv4 addresses
*/
*/
struct IPv4HttpAddressWrapper *prev;
- struct IPv4HttpAddress *addr;
-};
-
-/**
- * Network format for IPv6 addresses.
- */
-struct IPv6HttpAddress
-{
- /**
- * IPv6 address.
- */
- struct in6_addr ipv6_addr GNUNET_PACKED;
-
- /**
- * Port number, in network byte order.
- */
- uint16_t port GNUNET_PACKED;
-
+ struct sockaddr_in addr;
};
/**
*/
struct IPv6HttpAddressWrapper *prev;
- struct IPv6HttpAddress *addr;
+ /**
+ * IPv6 address.
+ */
+ struct sockaddr_in6 addr GNUNET_PACKED;
};
struct PrettyPrinterContext *ppc;
const void *sb;
size_t sbs;
- struct sockaddr_in a4;
- struct sockaddr_in6 a6;
- const struct IPv4HttpAddress *t4;
- const struct IPv6HttpAddress *t6;
- uint16_t port;
+ uint16_t port = 0 ;
- if (addrlen == sizeof (struct IPv6HttpAddress))
+ if (addrlen == sizeof (struct sockaddr_in6))
{
- t6 = addr;
- memset (&a6, 0, sizeof (a6));
- a6.sin6_family = AF_INET6;
- a6.sin6_port = t6->port;
- memcpy (&a6.sin6_addr, &t6->ipv6_addr, sizeof (struct in6_addr));
- port = ntohs (t6->port);
- sb = &a6;
- sbs = sizeof (a6);
+ sb = addr;
+ sbs = sizeof (struct sockaddr_in6);
+
+ port = ntohs (((struct sockaddr_in6 *)addr)->sin6_port);
}
- else if (addrlen == sizeof (struct IPv4HttpAddress))
+ else if (addrlen == sizeof (struct sockaddr_in))
{
- t4 = addr;
- memset (&a4, 0, sizeof (a4));
- a4.sin_family = AF_INET;
- a4.sin_port = t4->port;
- a4.sin_addr.s_addr = t4->ipv4_addr;
- port = ntohs (t4->ipv4_addr);
- sb = &a4;
- sbs = sizeof (a4);
+ sb = &addr;
+ sbs = sizeof (struct sockaddr_in);
+ port = ntohs (((struct sockaddr_in *)addr)->sin_port);
}
else
{
static int
http_plugin_address_suggested (void *cls, const void *addr, size_t addrlen)
{
+
struct Plugin *plugin = cls;
- struct IPv4HttpAddress *v4;
- struct IPv6HttpAddress *v6;
struct IPv4HttpAddressWrapper *w_tv4 = plugin->ipv4_addr_head;
struct IPv6HttpAddressWrapper *w_tv6 = plugin->ipv6_addr_head;
GNUNET_assert (cls != NULL);
- if ((addrlen != sizeof (struct IPv4HttpAddress)) &&
- (addrlen != sizeof (struct IPv6HttpAddress)))
+ if ((addrlen != sizeof (struct sockaddr_in)) ||
+ (addrlen != sizeof (struct sockaddr_in6)))
return GNUNET_SYSERR;
- if (addrlen == sizeof (struct IPv4HttpAddress))
+
+ if (addrlen == sizeof (struct sockaddr_in))
{
- v4 = (struct IPv4HttpAddress *) addr;
while (w_tv4 != NULL)
{
- if (0 ==
- memcmp (&w_tv4->addr->ipv4_addr, &v4->ipv4_addr, sizeof (uint32_t)))
+ if (0 == memcmp (&w_tv4->addr, addr, sizeof (struct sockaddr_in)))
break;
w_tv4 = w_tv4->next;
}
else
return GNUNET_SYSERR;
}
- if (addrlen == sizeof (struct IPv6HttpAddress))
+ if (addrlen == sizeof (struct sockaddr_in6))
{
- v6 = (struct IPv6HttpAddress *) addr;
while (w_tv6 != NULL)
{
if (0 ==
- memcmp (&w_tv6->addr->ipv6_addr, &v6->ipv6_addr,
- sizeof (struct in6_addr)))
+ memcmp (&w_tv6->addr, addr,
+ sizeof (struct sockaddr_in6)))
break;
w_tv6 = w_tv6->next;
}
else
return GNUNET_SYSERR;
}
- return GNUNET_SYSERR;
+ return GNUNET_OK;
}
struct GNUNET_TIME_Relative
const char *
http_plugin_address_to_string (void *cls, const void *addr, size_t addrlen)
{
- const struct IPv4HttpAddress *t4;
- const struct IPv6HttpAddress *t6;
- struct sockaddr_in a4;
- struct sockaddr_in6 a6;
+
+ struct sockaddr_in *a4;
+ struct sockaddr_in6 *a6;
char *address;
static char rbuf[INET6_ADDRSTRLEN + 13];
uint16_t port;
int res = 0;
- if (addrlen == sizeof (struct IPv6HttpAddress))
+ if (addrlen == sizeof (struct sockaddr_in6))
{
+ a6 = (struct sockaddr_in6 *) addr;
address = GNUNET_malloc (INET6_ADDRSTRLEN);
- t6 = addr;
- a6.sin6_addr = t6->ipv6_addr;
- inet_ntop (AF_INET6, &(a6.sin6_addr), address, INET6_ADDRSTRLEN);
- port = ntohs (t6->port);
+ inet_ntop (AF_INET6, &(a6->sin6_addr), address, INET6_ADDRSTRLEN);
+ port = ntohs (a6->sin6_port);
}
- else if (addrlen == sizeof (struct IPv4HttpAddress))
+ else if (addrlen == sizeof (struct sockaddr_in))
{
+ a4 = (struct sockaddr_in *) addr;
address = GNUNET_malloc (INET_ADDRSTRLEN);
- t4 = addr;
- a4.sin_addr.s_addr = t4->ipv4_addr;
- inet_ntop (AF_INET, &(a4.sin_addr), address, INET_ADDRSTRLEN);
- port = ntohs (t4->port);
+ inet_ntop (AF_INET, &(a4->sin_addr), address, INET_ADDRSTRLEN);
+ port = ntohs (a4->sin_port);
}
else
{
#endif
GNUNET_assert (strlen (address) + 7 < (INET6_ADDRSTRLEN + 13));
- if (addrlen == sizeof (struct IPv6HttpAddress))
+ if (addrlen == sizeof (struct sockaddr_in6))
res = GNUNET_snprintf (rbuf, sizeof (rbuf), "%s://[%s]:%u/", protocol, address, port);
- else if (addrlen == sizeof (struct IPv4HttpAddress))
+ else if (addrlen == sizeof (struct sockaddr_in))
res = GNUNET_snprintf (rbuf, sizeof (rbuf), "%s://%s:%u/", protocol, address, port);
GNUNET_free (address);
e_peer = GNUNET_NO;
e_addr = GNUNET_NO;
-#if DEBUG_HTTP
- GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name,
- "Comparing session %X <-> %X\n", session, t);
-#endif
-
if (0 == memcmp (target, &t->target, sizeof (struct GNUNET_PeerIdentity)))
{
e_peer = GNUNET_YES;
}
if ((t == session))
{
-#if DEBUG_HTTP
- GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name,
- "Session %X: %s: \n", t, GNUNET_a2s (t->addr, t->addrlen));
- GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name,
- "Session %X: %s: \n", session, GNUNET_a2s (session->addr, session->addrlen));
-
-#endif
if(t->addrlen == session->addrlen)
{
- GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name,
- "length ok\n");
if (0 == memcmp (session->addr, t->addr, t->addrlen))
{
- GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name,
- "equal\n");
e_addr = GNUNET_YES;
}
}
}
}
-#if DEBUG_HTTP
- GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name,
- "Session %X: E_PEER YES : %i E_ADDR: %i force %u: \n", t, e_peer, e_addr, force_address);
-#endif
-
if ((e_peer == GNUNET_YES) && (force_address == GNUNET_NO))
{
s = t;
if ((e_peer == GNUNET_YES) && (force_address == GNUNET_YES) && (e_addr == GNUNET_YES))
{
s = t;
-#if DEBUG_HTTP
- GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name,
- "Session %X: HERE!\n", t, e_addr, s);
-#endif
break;
}
if ((e_peer == GNUNET_YES) && (force_address == GNUNET_SYSERR))
#if DEBUG_HTTP
GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name,
"Sending %u bytes to peer `%s' on address `%s' %X %i\n", msgbuf_size,
- GNUNET_i2s (target), GNUNET_a2s (addr, addrlen), session, force_address);
+ GNUNET_i2s (target), ((addr != NULL) && (addrlen != 0)) ? http_plugin_address_to_string(plugin, addr, addrlen) : "<inbound>", session, force_address);
#endif
struct Session *s = NULL;
{
#if DEBUG_HTTP
GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name,
- "Using client session to send to `%s'\n",
+ "Using outbound client session to send to `%s'\n",
GNUNET_i2s (target));
#endif
client_send (s, msg);
res = msgbuf_size;
#if DEBUG_HTTP
GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name,
- "Using server session to send to `%s'\n",
+ "Using inbound server session to send to `%s'\n",
GNUNET_i2s (target));
#endif
socklen_t addrlen)
{
struct Plugin *plugin = cls;
- struct IPv4HttpAddress *t4 = NULL;
struct IPv4HttpAddressWrapper *w_t4 = NULL;
- struct IPv6HttpAddress *t6 = NULL;
struct IPv6HttpAddressWrapper *w_t6 = NULL;
int af;
w_t4 = plugin->ipv4_addr_head;
while (w_t4 != NULL)
{
- int res = memcmp (&w_t4->addr->ipv4_addr,
- &((struct sockaddr_in *) addr)->sin_addr,
- sizeof (struct in_addr));
+ int res = memcmp (&w_t4->addr,
+ (struct sockaddr_in *) addr,
+ sizeof (struct sockaddr_in));
if (0 == res)
break;
if (w_t4 == NULL)
{
w_t4 = GNUNET_malloc (sizeof (struct IPv4HttpAddressWrapper));
- t4 = GNUNET_malloc (sizeof (struct IPv4HttpAddress));
- memcpy (&t4->ipv4_addr, &((struct sockaddr_in *) addr)->sin_addr,
- sizeof (struct in_addr));
- t4->port = htons (plugin->port);
-
- w_t4->addr = t4;
+ memcpy (&w_t4->addr, (struct sockaddr_in *) addr,
+ sizeof (struct sockaddr_in));
GNUNET_CONTAINER_DLL_insert (plugin->ipv4_addr_head,
plugin->ipv4_addr_tail, w_t4);
}
- plugin->env->notify_address (plugin->env->cls, add_remove, w_t4->addr,
- sizeof (struct IPv4HttpAddress));
+#if DEBUG_HTTP
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
+ "Notifying transport to add IPv4 address `%s'\n",
+ http_plugin_address_to_string(NULL, &w_t4->addr, sizeof (struct sockaddr_in)));
+#endif
+ plugin->env->notify_address (plugin->env->cls, add_remove, &w_t4->addr, sizeof (struct sockaddr_in));
break;
case AF_INET6:
w_t6 = plugin->ipv6_addr_head;
while (w_t6)
{
- int res = memcmp (&w_t6->addr->ipv6_addr,
- &((struct sockaddr_in6 *) addr)->sin6_addr,
- sizeof (struct in6_addr));
+ int res = memcmp (&w_t6->addr,
+ (struct sockaddr_in6 *) addr,
+ sizeof (struct sockaddr_in6));
if (0 == res)
break;
if (w_t6 == NULL)
{
w_t6 = GNUNET_malloc (sizeof (struct IPv6HttpAddressWrapper));
- t6 = GNUNET_malloc (sizeof (struct IPv6HttpAddress));
-
- memcpy (&t6->ipv6_addr, &((struct sockaddr_in6 *) addr)->sin6_addr,
- sizeof (struct in6_addr));
- t6->port = htons (plugin->port);
-
- w_t6->addr = t6;
+ memcpy (&w_t6->addr, (struct sockaddr_in6 *) addr,
+ sizeof (struct sockaddr_in6));
GNUNET_CONTAINER_DLL_insert (plugin->ipv6_addr_head,
plugin->ipv6_addr_tail, w_t6);
}
- plugin->env->notify_address (plugin->env->cls, add_remove, w_t6->addr,
- sizeof (struct IPv6HttpAddress));
+#if DEBUG_HTTP
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
+ "Notifying transport to add IPv6 address `%s'\n",
+ http_plugin_address_to_string(NULL, &w_t6->addr, sizeof (struct sockaddr_in)));
+#endif
+ plugin->env->notify_address (plugin->env->cls, add_remove, &w_t6->addr, sizeof (struct sockaddr_in6));
break;
default:
return;
w_t4 = plugin->ipv4_addr_head;
while (w_t4 != NULL)
{
- int res = memcmp (&w_t4->addr->ipv4_addr,
+ int res = memcmp (&(w_t4->addr.sin_addr),
&((struct sockaddr_in *) addr)->sin_addr,
sizeof (struct in_addr));
}
if (w_t4 == NULL)
return;
- plugin->env->notify_address (plugin->env->cls, add_remove, w_t4->addr,
- sizeof (struct IPv4HttpAddress));
+
+#if DEBUG_HTTP
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
+ "Notifying transport to remove IPv4 address `%s'\n",
+ http_plugin_address_to_string(NULL, &w_t4->addr, sizeof (struct sockaddr_in)));
+#endif
+ plugin->env->notify_address (plugin->env->cls, add_remove, &w_t4->addr,
+ sizeof (struct sockaddr_in));
GNUNET_CONTAINER_DLL_remove (plugin->ipv4_addr_head, plugin->ipv4_addr_tail,
w_t4);
- GNUNET_free (w_t4->addr);
GNUNET_free (w_t4);
break;
case AF_INET6:
w_t6 = plugin->ipv6_addr_head;
while (w_t6 != NULL)
{
- int res = memcmp (&w_t6->addr->ipv6_addr,
+ int res = memcmp (&(w_t6->addr.sin6_addr),
&((struct sockaddr_in6 *) addr)->sin6_addr,
sizeof (struct in6_addr));
}
if (w_t6 == NULL)
return;
- plugin->env->notify_address (plugin->env->cls, add_remove, w_t6->addr,
- sizeof (struct IPv6HttpAddress));
+#if DEBUG_HTTP
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
+ "Notifying transport to remove IPv6 address `%s'\n",
+ http_plugin_address_to_string(NULL, &w_t4->addr, sizeof (struct sockaddr_in)));
+#endif
+ plugin->env->notify_address (plugin->env->cls, add_remove, &w_t6->addr,
+ sizeof (struct sockaddr_in6 ));
GNUNET_CONTAINER_DLL_remove (plugin->ipv6_addr_head, plugin->ipv6_addr_tail,
w_t6);
- GNUNET_free (w_t6->addr);
GNUNET_free (w_t6);
break;
default:
{
GNUNET_assert (cls != NULL);
struct Plugin *plugin = cls;
- static int limit;
+ //static int limit;
#if DEBUG_HTTP
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
"NPMC called %s to address `%s'\n",
{
case GNUNET_YES:
// FIXME DEBUGGING
- if (limit < 1)
+ //if (limit < 1)
nat_add_address (cls, add_remove, addr, addrlen);
- limit++;
+ //limit++;
// FIXME END
break;
case GNUNET_NO:
w_t4 = plugin->ipv4_addr_head;
GNUNET_CONTAINER_DLL_remove (plugin->ipv4_addr_head, plugin->ipv4_addr_tail,
w_t4);
- GNUNET_free (w_t4->addr);
GNUNET_free (w_t4);
}
w_t6 = plugin->ipv6_addr_head;
GNUNET_CONTAINER_DLL_remove (plugin->ipv6_addr_head, plugin->ipv6_addr_tail,
w_t6);
- GNUNET_free (w_t6->addr);
GNUNET_free (w_t6);
}
}
server_send_callback (void *cls, uint64_t pos, char *buf, size_t max)
{
struct Session *s = cls;
+ struct Plugin *plugin = s->plugin;
struct HTTP_Message *msg;
int bytes_read = 0;
//static int c = 0;
}
#if VERBOSE_CLIENT
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connection %X: MHD has sent %u bytes\n",
- s, bytes_read);
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
+ "Server: %X: sent %u bytes\n",
+ s, bytes_read);
#endif
return bytes_read;
}
plugin->cur_connections++;
#if VERBOSE_SERVER
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Server: New inbound connection from %s with tag %u\n", GNUNET_i2s(&target), tag);
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
+ "Server: New inbound connection from %s with tag %u\n", GNUNET_i2s(&target), tag);
#endif
/* find duplicate session */
if (t != NULL)
{
#if VERBOSE_SERVER
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Server: Duplicate session, dismissing new connection from peer `%s'\n", GNUNET_i2s (&target));
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
+ "Server: Duplicate session, dismissing new connection from peer `%s'\n", GNUNET_i2s (&target));
#endif
goto error;
}
goto create;
#if VERBOSE_SERVER
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Server: Found existing semi-session for `%s'\n", GNUNET_i2s (&target));
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
+ "Server: Found existing semi-session for `%s'\n", GNUNET_i2s (&target));
#endif
if ((direction == _SEND) && (t->server_send != NULL))
{
#if VERBOSE_SERVER
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Server: Duplicate GET session, dismissing new connection from peer `%s'\n", GNUNET_i2s (&target));
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
+ "Server: Duplicate GET session, dismissing new connection from peer `%s'\n", GNUNET_i2s (&target));
#endif
goto error;
}
GNUNET_CONTAINER_DLL_remove(plugin->server_semi_head, plugin->server_semi_tail, s);
GNUNET_CONTAINER_DLL_insert(plugin->head, plugin->tail, s);
#if VERBOSE_SERVER
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Server: Found matching semi-session, merging session for peer `%s'\n", GNUNET_i2s (&target));
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
+ "Server: Found matching semi-session, merging session for peer `%s'\n", GNUNET_i2s (&target));
#endif
goto found;
if ((direction == _RECEIVE) && (t->server_recv != NULL))
{
#if VERBOSE_SERVER
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Server: Duplicate PUT session, dismissing new connection from peer `%s'\n", GNUNET_i2s (&target));
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
+ "Server: Duplicate PUT session, dismissing new connection from peer `%s'\n", GNUNET_i2s (&target));
#endif
goto error;
}
GNUNET_CONTAINER_DLL_remove(plugin->server_semi_head, plugin->server_semi_tail, s);
GNUNET_CONTAINER_DLL_insert(plugin->head, plugin->tail, s);
#if VERBOSE_SERVER
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Server: Found matching semi-session, merging session for peer `%s'\n", GNUNET_i2s (&target));
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
+ "Server: Found matching semi-session, merging session for peer `%s'\n", GNUNET_i2s (&target));
#endif
goto found;
}
create:
/* create new session */
#if VERBOSE_SERVER
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Server: Creating new session for peer `%s' \n", GNUNET_i2s (&target));
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
+ "Server: Creating new session for peer `%s' \n", GNUNET_i2s (&target));
#endif
- s = create_session(plugin,
+ s = create_session (plugin,
&target,
conn_info->client_addr,
addrlen,
goto found;
error:
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Server: Invalid connection request\n");
+#if VERBOSE_SERVER
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
+ "Server: Invalid connection request\n");
+#endif
response = MHD_create_response_from_data (strlen (HTTP_ERROR_RESPONSE),HTTP_ERROR_RESPONSE, MHD_NO, MHD_NO);
res = MHD_queue_response (mhd_connection, MHD_HTTP_NOT_FOUND, response);
MHD_destroy_response (response);
s->server_recv = sc;
int to = (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value / 1000);
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Server: Setting Timeout to %u\n", to);
- //MHD_set_connection_option (mhd_connection, MHD_CONNECTION_OPTION_TIMEOUT, to);
+#if VERBOSE_SERVER
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
+ "Server: Setting Timeout to %u\n", to);
+#endif
+ MHD_set_connection_option (mhd_connection, MHD_CONNECTION_OPTION_TIMEOUT, to);
(*httpSessionCache) = sc;
}
{
#if VERBOSE_SERVER
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
- "Server: peer `%s' PUT on address `%s' connected\n",
+ "Server: Peer `%s' PUT on address `%s' connected\n",
GNUNET_i2s (&s->target), GNUNET_a2s (s->addr, s->addrlen));
#endif
return MHD_YES;
#endif
if ((GNUNET_TIME_absolute_get().abs_value < s->delay.abs_value))
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Connection %X: PUT with %u bytes forwarded to MST\n", s,
+#if VERBOSE_SERVER
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
+ "Server: %X: PUT with %u bytes forwarded to MST\n", s,
*upload_data_size);
-
+#endif
if (s->msg_tk == NULL)
{
s->msg_tk = GNUNET_SERVER_mst_create (&server_receive_mst_cb, s);
}
res = GNUNET_SERVER_mst_receive (s->msg_tk, s, upload_data, *upload_data_size, GNUNET_NO, GNUNET_NO);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Server: Received %Zu bytes\n",
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
+ "Server: Received %Zu bytes\n",
*upload_data_size);
(*upload_data_size) = 0;
}
t = t->next;
}
plugin->cur_connections--;
-
+/*
if (plugin->server_v4_task != GNUNET_SCHEDULER_NO_TASK)
{
GNUNET_SCHEDULER_cancel(plugin->server_v4_task);
plugin->server_v6_task = GNUNET_SCHEDULER_NO_TASK;
}
plugin->server_v6_task = server_schedule (plugin, plugin->server_v6);
-
+*/
if ((s->server_send == NULL) && (s->server_recv == NULL))
{
#if VERBOSE_SERVER