aboutsummaryrefslogtreecommitdiff
path: root/src/arm/arm_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-11-13 22:07:29 +0000
committerChristian Grothoff <christian@grothoff.org>2013-11-13 22:07:29 +0000
commitb9e05ddfffa6e716b1e725d367d6dc3e2a1cde02 (patch)
tree34b775b9f7aee30925ec7ff7901ffeb0e5cd3690 /src/arm/arm_api.c
parenta256932620856c72b3dd3bd53d8aef86c4688abc (diff)
downloadgnunet-b9e05ddfffa6e716b1e725d367d6dc3e2a1cde02.tar.gz
gnunet-b9e05ddfffa6e716b1e725d367d6dc3e2a1cde02.zip
-fix message alignment to avoid bus error, indentation, style fixes
Diffstat (limited to 'src/arm/arm_api.c')
-rw-r--r--src/arm/arm_api.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/arm/arm_api.c b/src/arm/arm_api.c
index 6dfe65702..9644026d6 100644
--- a/src/arm/arm_api.c
+++ b/src/arm/arm_api.c
@@ -348,6 +348,7 @@ client_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
348 return; 348 return;
349 } 349 }
350 arm_msg = (const struct GNUNET_ARM_Message *) msg; 350 arm_msg = (const struct GNUNET_ARM_Message *) msg;
351 GNUNET_break (0 == ntohl (arm_msg->reserved));
351 id = GNUNET_ntohll (arm_msg->request_id); 352 id = GNUNET_ntohll (arm_msg->request_id);
352 cm = find_cm_by_id (h, id); 353 cm = find_cm_by_id (h, id);
353 if (NULL == cm) 354 if (NULL == cm)
@@ -529,6 +530,7 @@ transmit_arm_message (void *cls, size_t size, void *buf)
529 LOG (GNUNET_ERROR_TYPE_DEBUG, 530 LOG (GNUNET_ERROR_TYPE_DEBUG,
530 "Transmitting control message with %u bytes of type %u to arm with id %llu\n", 531 "Transmitting control message with %u bytes of type %u to arm with id %llu\n",
531 (unsigned int) msize, (unsigned int) ntohs (cm->msg->header.type), request_id); 532 (unsigned int) msize, (unsigned int) ntohs (cm->msg->header.type), request_id);
533 arm_msg->reserved = htonl (0);
532 arm_msg->request_id = GNUNET_htonll (request_id); 534 arm_msg->request_id = GNUNET_htonll (request_id);
533 memcpy (buf, cm->msg, msize); 535 memcpy (buf, cm->msg, msize);
534 /* Otherwise we won't be able to find it later! */ 536 /* Otherwise we won't be able to find it later! */
@@ -712,6 +714,7 @@ control_message_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *t
712{ 714{
713 struct ARMControlMessage *cm = cls; 715 struct ARMControlMessage *cm = cls;
714 struct GNUNET_ARM_Message *arm_msg; 716 struct GNUNET_ARM_Message *arm_msg;
717
715 LOG (GNUNET_ERROR_TYPE_DEBUG, 718 LOG (GNUNET_ERROR_TYPE_DEBUG,
716 "Control message timed out\n"); 719 "Control message timed out\n");
717 arm_msg = cm->msg; 720 arm_msg = cm->msg;
@@ -908,6 +911,7 @@ change_service (struct GNUNET_ARM_Handle *h, const char *service_name,
908 msg = GNUNET_malloc (sizeof (struct GNUNET_ARM_Message) + slen); 911 msg = GNUNET_malloc (sizeof (struct GNUNET_ARM_Message) + slen);
909 msg->header.size = htons (sizeof (struct GNUNET_ARM_Message) + slen); 912 msg->header.size = htons (sizeof (struct GNUNET_ARM_Message) + slen);
910 msg->header.type = htons (type); 913 msg->header.type = htons (type);
914 msg->reserved = htonl (0);
911 memcpy (&msg[1], service_name, slen); 915 memcpy (&msg[1], service_name, slen);
912 cm->msg = msg; 916 cm->msg = msg;
913 LOG (GNUNET_ERROR_TYPE_DEBUG, 917 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -1068,6 +1072,7 @@ GNUNET_ARM_request_service_list (struct GNUNET_ARM_Handle *h,
1068 msg = GNUNET_malloc (sizeof (struct GNUNET_ARM_Message)); 1072 msg = GNUNET_malloc (sizeof (struct GNUNET_ARM_Message));
1069 msg->header.size = htons (sizeof (struct GNUNET_ARM_Message)); 1073 msg->header.size = htons (sizeof (struct GNUNET_ARM_Message));
1070 msg->header.type = htons (GNUNET_MESSAGE_TYPE_ARM_LIST); 1074 msg->header.type = htons (GNUNET_MESSAGE_TYPE_ARM_LIST);
1075 msg->reserved = htonl (0);
1071 cm->msg = msg; 1076 cm->msg = msg;
1072 GNUNET_CONTAINER_DLL_insert_tail (h->control_pending_head, 1077 GNUNET_CONTAINER_DLL_insert_tail (h->control_pending_head,
1073 h->control_pending_tail, cm); 1078 h->control_pending_tail, cm);