gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r5206 - GNUnet/src/transports


From: gnunet
Subject: [GNUnet-SVN] r5206 - GNUnet/src/transports
Date: Sun, 1 Jul 2007 18:36:33 -0600 (MDT)

Author: grothoff
Date: 2007-07-01 18:36:33 -0600 (Sun, 01 Jul 2007)
New Revision: 5206

Modified:
   GNUnet/src/transports/tcp_helper.c
Log:
fixes

Modified: GNUnet/src/transports/tcp_helper.c
===================================================================
--- GNUnet/src/transports/tcp_helper.c  2007-07-01 23:19:39 UTC (rev 5205)
+++ GNUnet/src/transports/tcp_helper.c  2007-07-02 00:36:33 UTC (rev 5206)
@@ -122,8 +122,6 @@
   TCPSession * pos;
   TCPSession * prev;
   
-  printf("FTCP: %p\n",
-        tcpsession->lock);
   MUTEX_DESTROY(tcpsession->lock);
   FREENONNULL(tcpsession->accept_addr);
   pos = sessions;
@@ -384,6 +382,18 @@
   TSession * tsession = sock_ctx;
   TCPSession * tcpSession = tsession->internal;
 
+#if DEBUG_TCP
+  EncName enc;
+
+  IF_GELOG(ectx,
+          GE_DEBUG | GE_DEVELOPER | GE_BULK,
+          hash2enc(&tcpSession->sender.hashPubKey,
+                   &enc));
+  GE_LOG(ectx,
+        GE_DEBUG | GE_DEVELOPER | GE_BULK,
+        "Closed TCP socket of `%s'.\n",
+        &enc);
+#endif
   MUTEX_LOCK(tcplock);
   MUTEX_LOCK(tcpSession->lock);
   tcpSession->in_select = NO;
@@ -406,7 +416,7 @@
  */
 static int tcpSend(TSession * tsession,
                   const void * msg,
-                  const unsigned int size,
+                  unsigned int size,
                   int important) {
   TCPSession * tcpSession;
   MESSAGE_HEADER * mp;
@@ -417,6 +427,21 @@
     GE_BREAK(ectx, 0);
     return SYSERR; /* too big */
   }
+  if (tcpSession->in_select == NO) {
+#if DEBUG_TCP
+    EncName enc;
+    
+    IF_GELOG(ectx,
+            GE_DEBUG | GE_DEVELOPER | GE_BULK,
+            hash2enc(&tcpSession->sender.hashPubKey,
+                     &enc));
+    GE_LOG(ectx,
+          GE_DEBUG | GE_DEVELOPER | GE_BULK,
+          "Cannot send message - TCP socket of `%s' already closed!\n",
+          &enc);
+#endif
+    return SYSERR;
+  }
   if (selector == NULL) {
     if (stats != NULL)
       stats->change(stat_bytesDropped,





reply via email to

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