[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r11432 - gnunet/src/transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r11432 - gnunet/src/transport |
Date: |
Wed, 19 May 2010 10:34:31 +0200 |
Author: wachs
Date: 2010-05-19 10:34:31 +0200 (Wed, 19 May 2010)
New Revision: 11432
Modified:
gnunet/src/transport/plugin_transport_http.c
Log:
Modified: gnunet/src/transport/plugin_transport_http.c
===================================================================
--- gnunet/src/transport/plugin_transport_http.c 2010-05-19 07:27:02 UTC
(rev 11431)
+++ gnunet/src/transport/plugin_transport_http.c 2010-05-19 08:34:31 UTC
(rev 11432)
@@ -142,6 +142,12 @@
*/
struct Session *sessions;
+ /**
+ * Number of active sessions
+ */
+
+ unsigned int session_count;
+
};
/**
@@ -347,6 +353,7 @@
/* create current session object */
current_session = GNUNET_malloc ( sizeof( struct Session) );
current_session->ip = address;
+ current_session->next = NULL;
/* Every connection is accepted, nothing more to do here */
return MHD_YES;
@@ -369,20 +376,47 @@
const char *upload_data,
size_t * upload_data_size, void **httpSessionCache)
{
- struct Session * http_session;
struct MHD_Response *response;
- http_session = *httpSessionCache;
+ struct Session * cs;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"HTTP Daemon has an incoming `%s'
request from `%s'\n",method, current_session->ip);
/* Check if new or already known session */
- if ( NULL == http_session )
+ if ( NULL != current_session )
{
- /* Create a new session */
+ /* Insert session into linked list */
+ if ( plugin->sessions == NULL)
+ {
+ plugin->sessions = current_session;
+ plugin->session_count = 1;
+ }
- /* Insert session into linked list*/
+ cs = plugin->sessions;
+ while ( cs->next != NULL )
+ {
+ cs = cs->next;
+ }
+ if (cs != current_session)
+ {
+ cs->next = current_session;
+ plugin->session_count++;
+ }
+
+ /* iter over list */
+ cs = plugin->sessions;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Sessions in list %u
\n",plugin->session_count);
+ while (cs!=NULL)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Session: %s \n",cs->ip);
+ cs = cs->next;
+
+ }
/* Set closure */
+ if (*httpSessionCache == NULL)
+ {
+ *httpSessionCache = current_session;
+ }
}
/* Since connection is established, we can unlock */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r11432 - gnunet/src/transport,
gnunet <=