Messages with a _file method contain a file,
which is saved to disk upon reception at the following location:
-$GNUNET_DATA_HOME/social/files/<H(place_pub)>/<message_id>
+$GNUNET_DATA_HOME/social/files/<H(place_pub)>/<H(message_id)>
### Environment
/**
* Establish application connection to the social service.
*
- * The @host_place_cb and @guest_place_cb functions are
+ * The @host_cb and @guest_cb functions are
* initially called for each entered places,
* then later each time a new place is entered with the current app ID.
*
/**
* Disconnect app.
*
- * @param c
- * App handle.
+ * @param app
+ * Application handle.
+ * @param disconnect_cb
+ * Disconnect callback.
+ * @param disconnect_cls
+ * Disconnect closure.
*/
void
GNUNET_SOCIAL_app_disconnect (struct GNUNET_SOCIAL_App *app,
struct GNUNET_DISK_FileHandle *
fh = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_WRITE,
GNUNET_DISK_PERM_NONE);
- GNUNET_free (filename);
-
if (NULL != fh)
{
- GNUNET_DISK_file_seek (fh, plc->file_offset, GNUNET_DISK_SEEK_SET);
+ if (plc->file_offset != GNUNET_DISK_file_seek
+ (fh, plc->file_offset, GNUNET_DISK_SEEK_SET)) {
+ GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "seek", filename);
+ GNUNET_free (filename);
+ return;
+ }
GNUNET_DISK_file_write (fh, data, data_size);
GNUNET_DISK_file_close (fh);
+ GNUNET_free (filename);
}
else
{
+ GNUNET_free (filename);
GNUNET_break (0);
}
-
plc->file_offset += data_size;
}
char *fn_part = NULL;
GNUNET_asprintf (&fn_part, "%s.part", fn);
- rename (fn_part, fn);
+ if (rename (fn_part, fn)) {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Failed to rename %s into %s: %s (%d)\n",
+ fn_part, fn, strerror (errno), errno);
+ }
GNUNET_free (fn);
GNUNET_free (fn_part);
*
* @param app_id
* Application ID.
- * @param msg
- * Entry message.
+ * @param ereq
+ * Entry request.
*
* @return #GNUNET_OK if the place was added
* #GNUNET_NO if the place already exists in the hash map
*
* @param app_id
* Application ID.
- * @param msg
- * Entry message.
+ * @param ereq
+ * Entry request message.
*/
static int
app_place_save (const char *app_id,
/**
* Enter place as host.
*
- * @param req
- * Entry request.
+ * @param hreq
+ * Host entry request.
* @param[out] ret_hst
* Returned Host struct.
*
/**
* Enter place as guest.
*
- * @param req
- * Entry request.
+ * @param greq
+ * Guest entry request.
* @param[out] ret_gst
* Returned Guest struct.
*
len = strnlen (app_id, remaining);
if (len == remaining)
{
+ GNUNET_free (gst);
GNUNET_break (0);
return GNUNET_SYSERR;
}
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%zu + %u + %u != %u\n",
sizeof (*greq), relay_size, join_msg_size, greq_size);
- GNUNET_break (0);
GNUNET_free (gst);
+ GNUNET_break (0);
return GNUNET_SYSERR;
}
if (0 < relay_size)
/**
* Get method part of next message from transmission queue.
*
- * @param tmit_msg
- * Next item in message transmission queue.
- * @param[out] pmeth
- * The malloc'd message method is returned here.
+ * @param plc
+ * Place
*
* @return #GNUNET_OK on success
* #GNUNET_NO if there are no more messages in queue.
const struct GNUNET_CRYPTO_EcdsaPublicKey *pub_key,
const char *name)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Ego: %s\t%s\n",
- GNUNET_CRYPTO_ecdsa_public_key_to_string (pub_key), name);
+ char *s = GNUNET_CRYPTO_ecdsa_public_key_to_string (pub_key);
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Ego: %s\t%s\n", s, name);
+ GNUNET_free (s);
if (0 == memcmp (&ego_pub_key, pub_key, sizeof (*pub_key))
|| (NULL != opt_ego && 0 == strcmp (opt_ego, name)))
* @param cls closure
* @param args remaining command-line arguments
* @param cfgfile name of the configuration file used (for saving, can be NULL!)
- * @param cfg configuration
+ * @param c configuration
*/
static void
run (void *cls, char *const *args, const char *cfgfile,
* Configuration.
* @param id
* Application ID.
- * @param notify_host
+ * @param ego_cb
+ * Function to notify about an available ego.
+ * @param host_cb
* Function to notify about a place entered as host.
- * @param notify_guest
- * Function to notify about a place entered as guest..
- * @param notify_cls
+ * @param guest_cb
+ * Function to notify about a place entered as guest.
+ * @param cls
* Closure for the callbacks.
*
* @return Handle that can be used to stop listening.
*
* @param app
* Application handle.
+ * @param disconnect_cb
+ * Disconnect callback.
+ * @param disconnect_cls
+ * Disconnect closure.
*/
void
GNUNET_SOCIAL_app_disconnect (struct GNUNET_SOCIAL_App *app,
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: Host received entry request from guest (try %u).\n",
- test, join_req_count);
+ (uint8_t) test, join_req_count);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"%s\n%.*s\n",
method_name, data_size, (const char *) data);