-fix NPE
[oweals/gnunet.git] / src / transport / plugin_transport_unix.c
index 4608691815fc3349c11923238c459d4dd711601b..a664941e0adf040db5dd12c01891e5772c02f837 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet
-     (C) 2010-2014 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2010-2014 Christian Grothoff (and other contributing authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -14,8 +14,8 @@
 
      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., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
+     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+     Boston, MA 02110-1301, USA.
 */
 
 /**
@@ -317,11 +317,6 @@ struct Plugin
    */
   uint32_t myoptions;
 
-  /**
-   * ATS network
-   */
-  struct GNUNET_ATS_Information ats_network;
-
   /**
    * Are we using an abstract UNIX domain socket?
    */
@@ -947,12 +942,12 @@ static void
 unix_demultiplexer (struct Plugin *plugin,
                     struct GNUNET_PeerIdentity *sender,
                     const struct GNUNET_MessageHeader *currhdr,
-                    const struct UnixAddress *ua, size_t ua_len)
+                    const struct UnixAddress *ua,
+                    size_t ua_len)
 {
   struct Session *session;
   struct GNUNET_HELLO_Address *address;
 
-  GNUNET_break (ntohl(plugin->ats_network.value) != GNUNET_ATS_NET_UNSPECIFIED);
   GNUNET_assert (ua_len >= sizeof (struct UnixAddress));
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Received message from %s\n",
@@ -975,7 +970,7 @@ unix_demultiplexer (struct Plugin *plugin,
     plugin->env->session_start (NULL,
                                 session->address,
                                 session,
-                                &plugin->ats_network, 1);
+                                GNUNET_ATS_NET_LOOPBACK);
   }
   else
   {
@@ -986,10 +981,6 @@ unix_demultiplexer (struct Plugin *plugin,
                         session->address,
                         session,
                         currhdr);
-  plugin->env->update_address_metrics (plugin->env->cls,
-                                       session->address,
-                                       session,
-                                      &plugin->ats_network, 1);
 }
 
 
@@ -1387,12 +1378,12 @@ unix_transport_server_start (void *cls)
     plugin->unix_socket_path[0] = '@';
     un->sun_path[0] = '\0';
   }
-  plugin->ats_network = plugin->env->get_address_type (plugin->env->cls, (const struct sockaddr *) un, un_len);
   plugin->unix_sock.desc =
       GNUNET_NETWORK_socket_create (AF_UNIX, SOCK_DGRAM, 0);
   if (NULL == plugin->unix_sock.desc)
   {
     GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "socket");
+    GNUNET_free (un);
     return GNUNET_SYSERR;
   }
   if ('\0' != un->sun_path[0])