gnunet-svn
[Top][All Lists]
Advanced

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

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


From: grothoff
Subject: [GNUnet-SVN] r555 - GNUnet/src/transports
Date: Fri, 1 Apr 2005 16:38:41 -0800 (PST)

Author: grothoff
Date: 2005-04-01 16:38:39 -0800 (Fri, 01 Apr 2005)
New Revision: 555

Modified:
   GNUnet/src/transports/tcp.c
Log:
merg

Modified: GNUnet/src/transports/tcp.c
===================================================================
--- GNUnet/src/transports/tcp.c 2005-04-02 00:38:09 UTC (rev 554)
+++ GNUnet/src/transports/tcp.c 2005-04-02 00:38:39 UTC (rev 555)
@@ -28,7 +28,7 @@
 #include "gnunet_transport.h"
 #include "platform.h"
 
-#define DEBUG_TCP YES 
+#define DEBUG_TCP NO 
 
 /**
  * after how much time of the core not being associated with a tcp
@@ -794,8 +794,13 @@
   size_t ret;
   int success;
 
-  if (tcp_shutdown == YES)
+  if (tcp_shutdown == YES) {
+#if DEBUG_TCP
+    LOG(LOG_DEBUG,
+        "tcpDirectSend called while TCP transport is shutdown.\n");            
    
+#endif   
     return SYSERR;
+  }
   if (tcpSession->sock == -1) {
 #if DEBUG_TCP
     LOG(LOG_INFO,
@@ -810,6 +815,10 @@
   MUTEX_LOCK(&tcplock);
   if (tcpSession->wpos > 0) {
     /* select already pending... */
+#if DEBUG_TCP
+         LOG(LOG_DEBUG,
+       "write already pending, will not take additional message.\n");
+#endif    
     MUTEX_UNLOCK(&tcplock);
     return SYSERR;
   }
@@ -1112,17 +1121,27 @@
   TCPMessagePack * mp;
   int ok;
 
-  if (size >= MAX_BUFFER_SIZE)
+  if (size >= MAX_BUFFER_SIZE) {
+    BREAK();
     return SYSERR;
+  }
 
-  if (tcp_shutdown == YES)
+  if (tcp_shutdown == YES) {
+#if TCP_DEBUG
+         LOG(LOG_DEBUG, "tcpSend called while TCP is shutdown.\n");
+#endif   
     return SYSERR;
+  }   
   if (size == 0) {
     BREAK();
     return SYSERR;
   }
-  if (((TCPSession*)tsession->internal)->sock == -1)
+  if (((TCPSession*)tsession->internal)->sock == -1) {
+#if TCP_DEBUG
+         LOG(LOG_DEBUG, "tcpSend called after other side closed 
connection.\n");
+#endif    
     return SYSERR; /* other side closed connection */
+  }  
   mp = MALLOC(sizeof(TCPMessagePack) + size);
   memcpy(&mp[1],
         msg,





reply via email to

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