gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r11457 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r11457 - gnunet/src/transport
Date: Thu, 20 May 2010 15:42:55 +0200

Author: wachs
Date: 2010-05-20 15:42:54 +0200 (Thu, 20 May 2010)
New Revision: 11457

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-20 12:50:44 UTC 
(rev 11456)
+++ gnunet/src/transport/plugin_transport_http.c        2010-05-20 13:42:54 UTC 
(rev 11457)
@@ -255,33 +255,6 @@
 }
 #endif
 
-/**
- * Creates a http session in our linked list by peer identity
- * Only peer is set here, all other  fields have to be set by calling method
- * @param peer peeridentity
- * @return created http session
- */
-static struct Session * create_session_by_pi( const struct GNUNET_PeerIdentity 
*peer )
-{
-  struct Session * cur;
-  struct Session * last_in_list;
-  /* Create a new session object */
-  cur = GNUNET_malloc (sizeof (struct Session));
-  memcpy( &(cur->sender), peer, sizeof( struct GNUNET_PeerIdentity ) );
-
-  cur->next = NULL;
-
-  /* Insert into linked list */
-  last_in_list = plugin->sessions;
-  while (last_in_list->next != NULL)
-  {
-    last_in_list = last_in_list->next;
-  }
-  last_in_list->next = cur;
-
-  return cur;
-}
-
 #if 0
 /**
  * Creates a http session in our linked list by ip address
@@ -325,8 +298,6 @@
     /* session set to inactive */
     cs->is_active = GNUNET_NO;
   }
-  else
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Not accepted connection was 
terminated\n");
   return;
 }
 
@@ -632,17 +603,49 @@
                       cont, void *cont_cls)
 {
   struct Session* ses;
+  struct Session* ses_temp;
   int bytes_sent = 0;
   /*  struct Plugin *plugin = cls; */
   CURL *curl_handle;
   /* CURLcode res; */
 
   /* find session for peer */
+
+
   ses = find_session_by_pi (target);
-  if ( ses == NULL) create_session_by_pi (target);
 
-  char *url = "http://localhost:12389";;
+  if ( ses == NULL)
+  {
+    /* create new session object */
+    ses = GNUNET_malloc ( sizeof( struct Session) );
+    ses->addr = GNUNET_malloc ( sizeof (struct sockaddr_in) );
 
+    //ses->ip = address;
+    // memcpy(ses->addr, conn_info->client_addr, sizeof (struct sockaddr_in));
+    memcpy(&ses->sender, &target, sizeof (struct GNUNET_PeerIdentity));
+    ses->next = NULL;
+    ses->is_active = GNUNET_YES;
+
+    /* Insert session into linked list */
+    if ( plugin->sessions == NULL)
+    {
+      plugin->sessions = ses;
+      plugin->session_count = 1;
+    }
+    ses_temp = plugin->sessions;
+    while ( ses_temp->next != NULL )
+    {
+      ses_temp = ses_temp->next;
+    }
+    if (ses_temp != ses )
+    {
+      ses_temp->next = ses;
+      plugin->session_count++;
+    }
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"New Session `%s' inserted, count %u 
\n", GNUNET_i2s(target), plugin->session_count);  }
+
+  char *url = "";
+
   curl_handle = curl_easy_init();
   if( NULL == curl_handle)
   {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]