projects
/
oweals
/
gnunet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
565ae6d
)
(no commit message)
author
Matthias Wachs
<wachs@net.in.tum.de>
Wed, 19 May 2010 08:34:31 +0000
(08:34 +0000)
committer
Matthias Wachs
<wachs@net.in.tum.de>
Wed, 19 May 2010 08:34:31 +0000
(08:34 +0000)
src/transport/plugin_transport_http.c
patch
|
blob
|
history
diff --git
a/src/transport/plugin_transport_http.c
b/src/transport/plugin_transport_http.c
index e52fbfd58094b935c208c837164cea1305911aa2..90dcdf5c7cef3e17501618d1a6daf0d6c4a99a9f 100644
(file)
--- a/
src/transport/plugin_transport_http.c
+++ b/
src/transport/plugin_transport_http.c
@@
-142,6
+142,12
@@
struct Plugin
*/
struct Session *sessions;
*/
struct Session *sessions;
+ /**
+ * Number of active sessions
+ */
+
+ unsigned int session_count;
+
};
/**
};
/**
@@
-347,6
+353,7
@@
acceptPolicyCallback (void *cls,
/* create current session object */
current_session = GNUNET_malloc ( sizeof( struct Session) );
current_session->ip = address;
/* 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;
/* Every connection is accepted, nothing more to do here */
return MHD_YES;
@@
-369,20
+376,47
@@
accessHandlerCallback (void *cls,
const char *upload_data,
size_t * upload_data_size, void **httpSessionCache)
{
const char *upload_data,
size_t * upload_data_size, void **httpSessionCache)
{
- struct Session * http_session;
struct MHD_Response *response;
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 */
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;
+ }
+
+ cs = plugin->sessions;
+ while ( cs->next != NULL )
+ {
+ cs = cs->next;
+ }
+
+ if (cs != current_session)
+ {
+ cs->next = current_session;
+ plugin->session_count++;
+ }
- /* Insert session into linked list*/
+ /* 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 */
/* Set closure */
+ if (*httpSessionCache == NULL)
+ {
+ *httpSessionCache = current_session;
+ }
}
/* Since connection is established, we can unlock */
}
/* Since connection is established, we can unlock */