if (GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_METHOD == ptype)
{
/* FIXME: last message was unfinished, cancel & remove from queue */
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "FIXME: last message was unfinished.\n");
}
tmit_msg = psyc_transmit_queue_message (&hst->plc, NULL, ntohs (pmsg->size),
switch (ptype)
{
case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_METHOD:
- GNUNET_CONTAINER_multihashmap_put (hst->relay_msgs, &nym_pub_hash, tmit_msg,
- GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
+ GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multihashmap_put
+ (hst->relay_msgs, &nym_pub_hash, tmit_msg,
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
break;
case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_END:
case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_CANCEL:
- GNUNET_CONTAINER_multihashmap_remove (hst->relay_msgs, &nym_pub_hash, tmit_msg);
+ GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove
+ (hst->relay_msgs, &nym_pub_hash, tmit_msg));
break;
}
}
place_pub_str, DIR_SEPARATOR,
GNUNET_ntohll (msg->message_id));
GNUNET_free (place_pub_str);
- GNUNET_DISK_directory_create_for_file (filename);
+ if (GNUNET_SYSERR == GNUNET_DISK_directory_create_for_file (filename))
+ {
+ GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "create", filename);
+ GNUNET_free (filename);
+ return;
+ }
+
struct GNUNET_DISK_FileHandle *
fh = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_WRITE,
GNUNET_DISK_PERM_NONE);
if (NULL != fh)
{
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;
+ (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);
return;
}
+ struct GNUNET_PSYC_Message *join_msg = guest_enter_msg_create ();
gst = GNUNET_SOCIAL_guest_enter (app, ego, pub_key,
GNUNET_PSYC_SLAVE_JOIN_NONE,
- peer, 0, NULL, guest_enter_msg_create (),
- slicer_create (),
+ peer, 0, NULL, join_msg, slicer_create (),
guest_recv_local_enter,
guest_recv_entry_decision, NULL);
+ GNUNET_free (join_msg);
plc = GNUNET_SOCIAL_guest_get_place (gst);
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Entering to place by name as guest.\n");
+ struct GNUNET_PSYC_Message *join_msg = guest_enter_msg_create ();
gst = GNUNET_SOCIAL_guest_enter_by_name (app, ego, gns_name, NULL,
- guest_enter_msg_create (), slicer,
+ join_msg, slicer,
guest_recv_local_enter,
guest_recv_entry_decision, NULL);
+ GNUNET_free (join_msg);
plc = GNUNET_SOCIAL_guest_get_place (gst);
}
if (opt_ego)
{
- GNUNET_CRYPTO_ecdsa_public_key_from_string (opt_ego,
+ if (GNUNET_OK !=
+ GNUNET_CRYPTO_ecdsa_public_key_from_string (opt_ego,
strlen (opt_ego),
- &ego_pub_key);
+ &ego_pub_key))
+ {
+ FPRINTF (stderr,
+ _("Public key `%s' malformed\n"),
+ opt_ego);
+ exit_fail ();
+ return;
+ }
}
core = GNUNET_CORE_connect (cfg, NULL, &core_connected, NULL, NULL,
if (GNUNET_YES == pmsg->is_host)
{
- struct GNUNET_SOCIAL_HostConnection *hconn = GNUNET_malloc (sizeof (*hconn));
- hconn->app = app;
- hconn->plc_msg = *pmsg;
- if (NULL != app->host_cb)
+ if (NULL != app->host_cb) {
+ struct GNUNET_SOCIAL_HostConnection *hconn = GNUNET_malloc (sizeof (*hconn));
+ hconn->app = app;
+ hconn->plc_msg = *pmsg;
app->host_cb (app->cb_cls, hconn, ego, &pmsg->place_pub_key, pmsg->place_state);
+ // FIXME: should this have a GNUNET_free (hconn) here?
+ }
}
- else
+ else if (NULL != app->guest_cb)
{
struct GNUNET_SOCIAL_GuestConnection *gconn = GNUNET_malloc (sizeof (*gconn));
gconn->app = app;
gconn->plc_msg = *pmsg;
- if (NULL != app->guest_cb)
- app->guest_cb (app->cb_cls, gconn, ego, &pmsg->place_pub_key, pmsg->place_state);
+ app->guest_cb (app->cb_cls, gconn, ego, &pmsg->place_pub_key, pmsg->place_state);
+ GNUNET_free (gconn); // FIXME: is this correct here?
}
}