[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r4950 - GNUnet/src/applications/advertising
From: |
gnunet |
Subject: |
[GNUnet-SVN] r4950 - GNUnet/src/applications/advertising |
Date: |
Fri, 8 Jun 2007 02:01:19 -0600 (MDT) |
Author: grothoff
Date: 2007-06-08 02:01:19 -0600 (Fri, 08 Jun 2007)
New Revision: 4950
Modified:
GNUnet/src/applications/advertising/advertising.c
Log:
re-use tsession to confirm HELLO if available
Modified: GNUnet/src/applications/advertising/advertising.c
===================================================================
--- GNUnet/src/applications/advertising/advertising.c 2007-06-08 07:45:03 UTC
(rev 4949)
+++ GNUnet/src/applications/advertising/advertising.c 2007-06-08 08:01:19 UTC
(rev 4950)
@@ -145,8 +145,8 @@
*/
static int
receivedhello(const PeerIdentity * sender,
- const MESSAGE_HEADER * message) {
- TSession * tsession;
+ const MESSAGE_HEADER * message,
+ TSession * tsession) {
P2P_hello_MESSAGE * copy;
PeerIdentity foreignId;
const P2P_hello_MESSAGE * msg;
@@ -155,6 +155,7 @@
int helloEnd;
int mtu;
int res;
+ int disconnect;
cron_t now;
/* first verify that it is actually a valid hello */
@@ -323,8 +324,12 @@
/* Establish session as advertised in the hello */
- tsession = transport->connect(msg);
+ disconnect = NO;
if (tsession == NULL) {
+ tsession = transport->connect(msg);
+ disconnect = YES;
+ }
+ if (tsession == NULL) {
if (stats != NULL)
stats->change(stat_hello_no_transport, 1);
return SYSERR; /* could not connect */
@@ -353,7 +358,8 @@
GE_LOG(ectx,
GE_INFO | GE_REQUEST | GE_USER,
_("Could not send HELLO+PING, ping buffer full.\n"));
- transport->disconnect(tsession);
+ if (disconnect == YES)
+ transport->disconnect(tsession);
if (stats != NULL)
stats->change(stat_hello_ping_busy, 1);
return SYSERR;
@@ -374,7 +380,8 @@
FREE(buffer);
if (stats != NULL)
stats->change(stat_hello_noselfad, 1);
- transport->disconnect(tsession);
+ if (disconnect == YES)
+ transport->disconnect(tsession);
return SYSERR;
}
res = OK;
@@ -399,7 +406,8 @@
stats->change(stat_plaintextPingSent, 1);
}
FREE(buffer);
- if (SYSERR == transport->disconnect(tsession))
+ if ( (disconnect == YES) &&
+ (SYSERR == transport->disconnect(tsession)) )
res = SYSERR;
return res;
}
@@ -713,7 +721,8 @@
ehelloHandler(const PeerIdentity * sender,
const MESSAGE_HEADER * message) {
if (OK == receivedhello(sender,
- message)) {
+ message,
+ NULL)) {
/* if the hello was ok, update traffic preference
for the peer (depending on how much we like
to learn about other peers) */
@@ -731,7 +740,8 @@
const MESSAGE_HEADER * message,
TSession * session) {
receivedhello(sender,
- message);
+ message,
+ session);
return OK;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r4950 - GNUnet/src/applications/advertising,
gnunet <=