fix div by zero
[oweals/gnunet.git] / src / transport / test_transport_api_monitor_peers.c
index 37f50c4fcacb66f4412f91db872f6b2ece4b4116..8a01b15a3d10d1fcf8ea0cfec45df2345eaee3f7 100644 (file)
@@ -2,20 +2,18 @@
      This file is part of GNUnet.
      Copyright (C) 2009, 2010, 2016 GNUnet e.V.
 
-     GNUnet is free software; you can redistribute it and/or modify
-     it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 3, or (at your
-     option) any later version.
+     GNUnet is free software: you can redistribute it and/or modify it
+     under the terms of the GNU Affero General Public License as published
+     by the Free Software Foundation, either version 3 of the License,
+     or (at your option) any later version.
 
      GNUnet is distributed in the hope that it will be useful, but
      WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     General Public License for more details.
-
-     You should have received a copy of the GNU General Public License
-     along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-     Boston, MA 02110-1301, USA.
+     Affero General Public License for more details.
+    
+     You should have received a copy of the GNU Affero General Public License
+     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 /**
  * @file transport/test_transport_api_monitor_peers.c
@@ -39,8 +37,6 @@
 
 #define TEST_MESSAGE_TYPE 12345
 
-static struct GNUNET_TRANSPORT_TransmitHandle *th;
-
 static struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *ccc;
 
 static struct GNUNET_TRANSPORT_PeerMonitoringContext *pmc_p1;
@@ -59,11 +55,6 @@ static int p2_c_notify;
 static void
 custom_shutdown (void *cls)
 {
-  if (th != NULL)
-  {
-    GNUNET_TRANSPORT_notify_transmit_ready_cancel (th);
-    th = NULL;
-  }
   if (NULL != pmc_p1)
   {
     GNUNET_TRANSPORT_monitor_peers_cancel (pmc_p1);
@@ -139,22 +130,6 @@ notify_connect (void *cls,
 }
 
 
-static void
-notify_disconnect (void *cls,
-                   struct GNUNET_TRANSPORT_TESTING_PeerContext *me,
-                   const struct GNUNET_PeerIdentity *other)
-{
-  GNUNET_TRANSPORT_TESTING_log_disconnect (cls,
-                                           me,
-                                           other);
-  if (NULL != th)
-  {
-    GNUNET_TRANSPORT_notify_transmit_ready_cancel (th);
-    th = NULL;
-  }
-}
-
-
 static void
 monitor1_cb (void *cls,
              const struct GNUNET_PeerIdentity *peer,
@@ -230,7 +205,7 @@ main (int argc, char *argv[])
     .config_file = "test_transport_api_data.conf",
     .rec = &notify_receive,
     .nc = &notify_connect,
-    .nd = &notify_disconnect,
+    .nd = &GNUNET_TRANSPORT_TESTING_log_disconnect,
     .shutdown_task = &custom_shutdown,
     .timeout = TIMEOUT
   };