diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/include/gnunet_social_service.h | 12 | ||||
-rw-r--r-- | src/social/gnunet-service-social.c | 43 | ||||
-rw-r--r-- | src/social/gnunet-social.c | 8 | ||||
-rw-r--r-- | src/social/social_api.c | 14 | ||||
-rw-r--r-- | src/social/test_social.c | 2 |
5 files changed, 48 insertions, 31 deletions
diff --git a/src/include/gnunet_social_service.h b/src/include/gnunet_social_service.h index b0f5dbd16..e9c7f309c 100644 --- a/src/include/gnunet_social_service.h +++ b/src/include/gnunet_social_service.h | |||
@@ -194,7 +194,7 @@ Description of file | |||
194 | 194 | ||
195 | Messages with a _file method contain a file, | 195 | Messages with a _file method contain a file, |
196 | which is saved to disk upon reception at the following location: | 196 | which is saved to disk upon reception at the following location: |
197 | $GNUNET_DATA_HOME/social/files/<H(place_pub)>/<message_id> | 197 | $GNUNET_DATA_HOME/social/files/<H(place_pub)>/<H(message_id)> |
198 | 198 | ||
199 | ### Environment | 199 | ### Environment |
200 | 200 | ||
@@ -386,7 +386,7 @@ typedef void | |||
386 | /** | 386 | /** |
387 | * Establish application connection to the social service. | 387 | * Establish application connection to the social service. |
388 | * | 388 | * |
389 | * The @host_place_cb and @guest_place_cb functions are | 389 | * The @host_cb and @guest_cb functions are |
390 | * initially called for each entered places, | 390 | * initially called for each entered places, |
391 | * then later each time a new place is entered with the current app ID. | 391 | * then later each time a new place is entered with the current app ID. |
392 | * | 392 | * |
@@ -416,8 +416,12 @@ GNUNET_SOCIAL_app_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
416 | /** | 416 | /** |
417 | * Disconnect app. | 417 | * Disconnect app. |
418 | * | 418 | * |
419 | * @param c | 419 | * @param app |
420 | * App handle. | 420 | * Application handle. |
421 | * @param disconnect_cb | ||
422 | * Disconnect callback. | ||
423 | * @param disconnect_cls | ||
424 | * Disconnect closure. | ||
421 | */ | 425 | */ |
422 | void | 426 | void |
423 | GNUNET_SOCIAL_app_disconnect (struct GNUNET_SOCIAL_App *app, | 427 | GNUNET_SOCIAL_app_disconnect (struct GNUNET_SOCIAL_App *app, |
diff --git a/src/social/gnunet-service-social.c b/src/social/gnunet-service-social.c index 287047f58..eca1b14d7 100644 --- a/src/social/gnunet-service-social.c +++ b/src/social/gnunet-service-social.c | |||
@@ -989,19 +989,23 @@ place_recv_save_data (void *cls, | |||
989 | struct GNUNET_DISK_FileHandle * | 989 | struct GNUNET_DISK_FileHandle * |
990 | fh = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_WRITE, | 990 | fh = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_WRITE, |
991 | GNUNET_DISK_PERM_NONE); | 991 | GNUNET_DISK_PERM_NONE); |
992 | GNUNET_free (filename); | ||
993 | |||
994 | if (NULL != fh) | 992 | if (NULL != fh) |
995 | { | 993 | { |
996 | GNUNET_DISK_file_seek (fh, plc->file_offset, GNUNET_DISK_SEEK_SET); | 994 | if (plc->file_offset != GNUNET_DISK_file_seek |
995 | (fh, plc->file_offset, GNUNET_DISK_SEEK_SET)) { | ||
996 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "seek", filename); | ||
997 | GNUNET_free (filename); | ||
998 | return; | ||
999 | } | ||
997 | GNUNET_DISK_file_write (fh, data, data_size); | 1000 | GNUNET_DISK_file_write (fh, data, data_size); |
998 | GNUNET_DISK_file_close (fh); | 1001 | GNUNET_DISK_file_close (fh); |
1002 | GNUNET_free (filename); | ||
999 | } | 1003 | } |
1000 | else | 1004 | else |
1001 | { | 1005 | { |
1006 | GNUNET_free (filename); | ||
1002 | GNUNET_break (0); | 1007 | GNUNET_break (0); |
1003 | } | 1008 | } |
1004 | |||
1005 | plc->file_offset += data_size; | 1009 | plc->file_offset += data_size; |
1006 | } | 1010 | } |
1007 | 1011 | ||
@@ -1033,7 +1037,11 @@ place_recv_save_eom (void *cls, | |||
1033 | char *fn_part = NULL; | 1037 | char *fn_part = NULL; |
1034 | GNUNET_asprintf (&fn_part, "%s.part", fn); | 1038 | GNUNET_asprintf (&fn_part, "%s.part", fn); |
1035 | 1039 | ||
1036 | rename (fn_part, fn); | 1040 | if (rename (fn_part, fn)) { |
1041 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1042 | "Failed to rename %s into %s: %s (%d)\n", | ||
1043 | fn_part, fn, strerror (errno), errno); | ||
1044 | } | ||
1037 | 1045 | ||
1038 | GNUNET_free (fn); | 1046 | GNUNET_free (fn); |
1039 | GNUNET_free (fn_part); | 1047 | GNUNET_free (fn_part); |
@@ -1098,8 +1106,8 @@ place_add (const struct PlaceEnterRequest *ereq) | |||
1098 | * | 1106 | * |
1099 | * @param app_id | 1107 | * @param app_id |
1100 | * Application ID. | 1108 | * Application ID. |
1101 | * @param msg | 1109 | * @param ereq |
1102 | * Entry message. | 1110 | * Entry request. |
1103 | * | 1111 | * |
1104 | * @return #GNUNET_OK if the place was added | 1112 | * @return #GNUNET_OK if the place was added |
1105 | * #GNUNET_NO if the place already exists in the hash map | 1113 | * #GNUNET_NO if the place already exists in the hash map |
@@ -1183,8 +1191,8 @@ app_place_add (const char *app_id, | |||
1183 | * | 1191 | * |
1184 | * @param app_id | 1192 | * @param app_id |
1185 | * Application ID. | 1193 | * Application ID. |
1186 | * @param msg | 1194 | * @param ereq |
1187 | * Entry message. | 1195 | * Entry request message. |
1188 | */ | 1196 | */ |
1189 | static int | 1197 | static int |
1190 | app_place_save (const char *app_id, | 1198 | app_place_save (const char *app_id, |
@@ -1302,8 +1310,8 @@ app_place_remove (const char *app_id, | |||
1302 | /** | 1310 | /** |
1303 | * Enter place as host. | 1311 | * Enter place as host. |
1304 | * | 1312 | * |
1305 | * @param req | 1313 | * @param hreq |
1306 | * Entry request. | 1314 | * Host entry request. |
1307 | * @param[out] ret_hst | 1315 | * @param[out] ret_hst |
1308 | * Returned Host struct. | 1316 | * Returned Host struct. |
1309 | * | 1317 | * |
@@ -1541,8 +1549,8 @@ client_recv_host_enter (void *cls, struct GNUNET_SERVER_Client *client, | |||
1541 | /** | 1549 | /** |
1542 | * Enter place as guest. | 1550 | * Enter place as guest. |
1543 | * | 1551 | * |
1544 | * @param req | 1552 | * @param greq |
1545 | * Entry request. | 1553 | * Guest entry request. |
1546 | * @param[out] ret_gst | 1554 | * @param[out] ret_gst |
1547 | * Returned Guest struct. | 1555 | * Returned Guest struct. |
1548 | * | 1556 | * |
@@ -1589,6 +1597,7 @@ guest_enter (const struct GuestEnterRequest *greq, struct Guest **ret_gst) | |||
1589 | len = strnlen (app_id, remaining); | 1597 | len = strnlen (app_id, remaining); |
1590 | if (len == remaining) | 1598 | if (len == remaining) |
1591 | { | 1599 | { |
1600 | GNUNET_free (gst); | ||
1592 | GNUNET_break (0); | 1601 | GNUNET_break (0); |
1593 | return GNUNET_SYSERR; | 1602 | return GNUNET_SYSERR; |
1594 | } | 1603 | } |
@@ -1623,8 +1632,8 @@ guest_enter (const struct GuestEnterRequest *greq, struct Guest **ret_gst) | |||
1623 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1632 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1624 | "%zu + %u + %u != %u\n", | 1633 | "%zu + %u + %u != %u\n", |
1625 | sizeof (*greq), relay_size, join_msg_size, greq_size); | 1634 | sizeof (*greq), relay_size, join_msg_size, greq_size); |
1626 | GNUNET_break (0); | ||
1627 | GNUNET_free (gst); | 1635 | GNUNET_free (gst); |
1636 | GNUNET_break (0); | ||
1628 | return GNUNET_SYSERR; | 1637 | return GNUNET_SYSERR; |
1629 | } | 1638 | } |
1630 | if (0 < relay_size) | 1639 | if (0 < relay_size) |
@@ -2595,10 +2604,8 @@ guest_transmit_notify_mod (void *cls, uint16_t *data_size, void *data, | |||
2595 | /** | 2604 | /** |
2596 | * Get method part of next message from transmission queue. | 2605 | * Get method part of next message from transmission queue. |
2597 | * | 2606 | * |
2598 | * @param tmit_msg | 2607 | * @param plc |
2599 | * Next item in message transmission queue. | 2608 | * Place |
2600 | * @param[out] pmeth | ||
2601 | * The malloc'd message method is returned here. | ||
2602 | * | 2609 | * |
2603 | * @return #GNUNET_OK on success | 2610 | * @return #GNUNET_OK on success |
2604 | * #GNUNET_NO if there are no more messages in queue. | 2611 | * #GNUNET_NO if there are no more messages in queue. |
diff --git a/src/social/gnunet-social.c b/src/social/gnunet-social.c index ed3801abc..68a45bd5e 100644 --- a/src/social/gnunet-social.c +++ b/src/social/gnunet-social.c | |||
@@ -1055,9 +1055,9 @@ app_recv_ego (void *cls, | |||
1055 | const struct GNUNET_CRYPTO_EcdsaPublicKey *pub_key, | 1055 | const struct GNUNET_CRYPTO_EcdsaPublicKey *pub_key, |
1056 | const char *name) | 1056 | const char *name) |
1057 | { | 1057 | { |
1058 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1058 | char *s = GNUNET_CRYPTO_ecdsa_public_key_to_string (pub_key); |
1059 | "Ego: %s\t%s\n", | 1059 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Ego: %s\t%s\n", s, name); |
1060 | GNUNET_CRYPTO_ecdsa_public_key_to_string (pub_key), name); | 1060 | GNUNET_free (s); |
1061 | 1061 | ||
1062 | if (0 == memcmp (&ego_pub_key, pub_key, sizeof (*pub_key)) | 1062 | if (0 == memcmp (&ego_pub_key, pub_key, sizeof (*pub_key)) |
1063 | || (NULL != opt_ego && 0 == strcmp (opt_ego, name))) | 1063 | || (NULL != opt_ego && 0 == strcmp (opt_ego, name))) |
@@ -1107,7 +1107,7 @@ core_connected (void *cls, const struct GNUNET_PeerIdentity *my_identity) | |||
1107 | * @param cls closure | 1107 | * @param cls closure |
1108 | * @param args remaining command-line arguments | 1108 | * @param args remaining command-line arguments |
1109 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) | 1109 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) |
1110 | * @param cfg configuration | 1110 | * @param c configuration |
1111 | */ | 1111 | */ |
1112 | static void | 1112 | static void |
1113 | run (void *cls, char *const *args, const char *cfgfile, | 1113 | run (void *cls, char *const *args, const char *cfgfile, |
diff --git a/src/social/social_api.c b/src/social/social_api.c index 926995f6b..c33f39dce 100644 --- a/src/social/social_api.c +++ b/src/social/social_api.c | |||
@@ -2452,11 +2452,13 @@ GNUNET_SOCIAL_zone_add_nym (const struct GNUNET_SOCIAL_App *app, | |||
2452 | * Configuration. | 2452 | * Configuration. |
2453 | * @param id | 2453 | * @param id |
2454 | * Application ID. | 2454 | * Application ID. |
2455 | * @param notify_host | 2455 | * @param ego_cb |
2456 | * Function to notify about an available ego. | ||
2457 | * @param host_cb | ||
2456 | * Function to notify about a place entered as host. | 2458 | * Function to notify about a place entered as host. |
2457 | * @param notify_guest | 2459 | * @param guest_cb |
2458 | * Function to notify about a place entered as guest.. | 2460 | * Function to notify about a place entered as guest. |
2459 | * @param notify_cls | 2461 | * @param cls |
2460 | * Closure for the callbacks. | 2462 | * Closure for the callbacks. |
2461 | * | 2463 | * |
2462 | * @return Handle that can be used to stop listening. | 2464 | * @return Handle that can be used to stop listening. |
@@ -2507,6 +2509,10 @@ GNUNET_SOCIAL_app_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
2507 | * | 2509 | * |
2508 | * @param app | 2510 | * @param app |
2509 | * Application handle. | 2511 | * Application handle. |
2512 | * @param disconnect_cb | ||
2513 | * Disconnect callback. | ||
2514 | * @param disconnect_cls | ||
2515 | * Disconnect closure. | ||
2510 | */ | 2516 | */ |
2511 | void | 2517 | void |
2512 | GNUNET_SOCIAL_app_disconnect (struct GNUNET_SOCIAL_App *app, | 2518 | GNUNET_SOCIAL_app_disconnect (struct GNUNET_SOCIAL_App *app, |
diff --git a/src/social/test_social.c b/src/social/test_social.c index dc73705c6..eb32a031f 100644 --- a/src/social/test_social.c +++ b/src/social/test_social.c | |||
@@ -1082,7 +1082,7 @@ host_answer_door (void *cls, | |||
1082 | 1082 | ||
1083 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1083 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
1084 | "Test #%u: Host received entry request from guest (try %u).\n", | 1084 | "Test #%u: Host received entry request from guest (try %u).\n", |
1085 | test, join_req_count); | 1085 | (uint8_t) test, join_req_count); |
1086 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1086 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1087 | "%s\n%.*s\n", | 1087 | "%s\n%.*s\n", |
1088 | method_name, data_size, (const char *) data); | 1088 | method_name, data_size, (const char *) data); |