tolerate additional IPv4 address now available for gnunet.org
[oweals/gnunet.git] / src / fs / fs_publish.c
index 01305d678c7145a5372b7619a7cb28c2dd16204b..71ab1122c8ce3d0baceeb0318f6bf07e47a342d9 100644 (file)
@@ -2,20 +2,20 @@
      This file is part of GNUnet.
      Copyright (C) 2009, 2010 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.
+     Affero 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.
+     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/>.
+
+     SPDX-License-Identifier: AGPL3.0-or-later
 */
 /**
  * @file fs/fs_publish.c
@@ -716,17 +716,21 @@ handle_index_start_failed (void *cls,
   struct GNUNET_FS_PublishContext *pc = cls;
   struct GNUNET_FS_FileInformation *p;
   const char *emsg = (const char *) &msg[1];
+  char *msgtxt;
 
   GNUNET_MQ_destroy (pc->mq);
   pc->mq = NULL;
   p = pc->fi_pos;
-  GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-              _("Can not index file `%s': %s.  Will try to insert instead.\n"),
-              p->filename,
-              gettext (emsg));
-  p->data.file.do_index = GNUNET_NO;
+  GNUNET_asprintf (&msgtxt,
+                   _("Can not index file `%s': %s.\n"),
+                   p->filename,
+                   gettext (emsg));
+  signal_publish_error (p,
+                        pc,
+                        msgtxt);
+  GNUNET_free (msgtxt);
   GNUNET_FS_file_information_sync_ (p);
-  publish_content (pc);
+  GNUNET_FS_publish_sync_ (pc);
 }
 
 
@@ -795,16 +799,16 @@ static void
 hash_for_index_cb (void *cls,
                   const struct GNUNET_HashCode *res)
 {
-  GNUNET_MQ_hd_fixed_size (index_start_ok,
-                           GNUNET_MESSAGE_TYPE_FS_INDEX_START_OK,
-                           struct GNUNET_MessageHeader);
-  GNUNET_MQ_hd_var_size (index_start_failed,
-                         GNUNET_MESSAGE_TYPE_FS_INDEX_START_FAILED,
-                         struct GNUNET_MessageHeader);
   struct GNUNET_FS_PublishContext *pc = cls;
   struct GNUNET_MQ_MessageHandler handlers[] = {
-    make_index_start_ok_handler (pc),
-    make_index_start_failed_handler (pc),
+    GNUNET_MQ_hd_fixed_size (index_start_ok,
+                             GNUNET_MESSAGE_TYPE_FS_INDEX_START_OK,
+                             struct GNUNET_MessageHeader,
+                             pc),
+    GNUNET_MQ_hd_var_size (index_start_failed,
+                           GNUNET_MESSAGE_TYPE_FS_INDEX_START_FAILED,
+                           struct GNUNET_MessageHeader,
+                           pc),
     GNUNET_MQ_handler_end ()
   };
   struct GNUNET_FS_FileInformation *p;
@@ -837,7 +841,7 @@ hash_for_index_cb (void *cls,
   GNUNET_assert (fn != NULL);
   slen = strlen (fn) + 1;
   if (slen >=
-      GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct IndexStartMessage))
+      GNUNET_MAX_MESSAGE_SIZE - sizeof (struct IndexStartMessage))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                 _
@@ -863,7 +867,7 @@ hash_for_index_cb (void *cls,
     GNUNET_free (fn);
     return;
   }
-  pc->mq = GNUNET_CLIENT_connecT (pc->h->cfg,
+  pc->mq = GNUNET_CLIENT_connect (pc->h->cfg,
                                   "fs",
                                   handlers,
                                   &index_mq_error_handler,
@@ -1003,11 +1007,11 @@ loc_mq_error_handler (void *cls,
 static void
 create_loc_uri (struct GNUNET_FS_PublishContext *pc)
 {
-  GNUNET_MQ_hd_fixed_size (signature_response,
-                           GNUNET_MESSAGE_TYPE_FS_REQUEST_LOC_SIGNATURE,
-                           struct ResponseLocSignatureMessage);
   struct GNUNET_MQ_MessageHandler handlers[] = {
-    make_signature_response_handler (pc),
+    GNUNET_MQ_hd_fixed_size (signature_response,
+                             GNUNET_MESSAGE_TYPE_FS_REQUEST_LOC_SIGNATURE,
+                             struct ResponseLocSignatureMessage,
+                             pc),
     GNUNET_MQ_handler_end ()
   };
   struct GNUNET_MQ_Envelope *env;
@@ -1016,7 +1020,7 @@ create_loc_uri (struct GNUNET_FS_PublishContext *pc)
 
   if (NULL != pc->mq)
     GNUNET_MQ_destroy (pc->mq);
-  pc->mq = GNUNET_CLIENT_connecT (pc->h->cfg,
+  pc->mq = GNUNET_CLIENT_connect (pc->h->cfg,
                                   "fs",
                                   handlers,
                                   &loc_mq_error_handler,
@@ -1226,7 +1230,7 @@ fip_signal_start (void *cls,
   {
     kc = GNUNET_FS_uri_ksk_get_keyword_count (*uri);
     pc->reserve_entries += kc;
-    pc->reserve_space += GNUNET_SERVER_MAX_MESSAGE_SIZE * kc;
+    pc->reserve_space += GNUNET_MAX_MESSAGE_SIZE * kc;
   }
   pi.status = GNUNET_FS_STATUS_PUBLISH_START;
   *client_info = GNUNET_FS_publish_make_status_ (&pi, pc, fi, 0);