wip
[oweals/gnunet.git] / src / transport / plugin_transport_tcp.c
index 1ffc8b2605f8efd82ce3b0e02f01c6753feafcb1..9dc67dcdf4eb098305c64658889e0fa9a2493da6 100644 (file)
@@ -1099,7 +1099,7 @@ disconnect_session (struct Session *session)
        GNUNET_SERVER_receive_done (session->client,
                                    GNUNET_SYSERR);     
     }
-  if (session->client != NULL) 
+  else if (session->client != NULL)
     GNUNET_SERVER_client_drop (session->client);
   GNUNET_STATISTICS_update (session->plugin->env->stats,
                            gettext_noop ("# TCP sessions active"),
@@ -1150,7 +1150,7 @@ select_better_session (struct Session *s1,
  * gnunet-nat-client to send dummy ICMP responses.
  *
  * @param plugin the plugin for this transport
- * @param addr the address of the peer (IPv4-only)
+ * @param sa the address of the peer (IPv4-only)
  */
 static void
 run_gnunet_nat_client (struct Plugin *plugin, 
@@ -1195,6 +1195,8 @@ run_gnunet_nat_client (struct Plugin *plugin,
                                  inet4,
                                  port_as_string, 
                                  NULL);
+  if (NULL == proc)
+    return;
   /* we know that the gnunet-nat-client will terminate virtually
      instantly */
   GNUNET_OS_process_wait (proc);
@@ -2334,7 +2336,7 @@ tcp_plugin_server_read (void *cls,
   struct TCPProbeContext *tcp_probe_ctx;
   struct GNUNET_CONNECTION_Handle *sock;
 
-  if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN)
+  if ( (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
     return;
   memset (mybuf, 0, sizeof(mybuf));
   bytes = GNUNET_DISK_file_read(plugin->server_stdout_handle, 
@@ -2348,6 +2350,7 @@ tcp_plugin_server_read (void *cls,
                       "Finished reading from server stdout with code: %d\n", 
                       bytes);
 #endif
+      /* FIXME: consider process_wait here? */
       return;
     }