aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-05-04 11:54:37 +0000
committerChristian Grothoff <christian@grothoff.org>2012-05-04 11:54:37 +0000
commitf067060a4ae63d6570e63db8ecb9d645f61c9ad4 (patch)
tree81847be6aec4de6c99338c820d3a2a3ad99abfe0 /src/core
parentbf72e81c5e5dfa30913d0e9fbca045f8701c605c (diff)
downloadgnunet-f067060a4ae63d6570e63db8ecb9d645f61c9ad4.tar.gz
gnunet-f067060a4ae63d6570e63db8ecb9d645f61c9ad4.zip
-fix expression order
Diffstat (limited to 'src/core')
-rw-r--r--src/core/gnunet-service-core_kx.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/core/gnunet-service-core_kx.c b/src/core/gnunet-service-core_kx.c
index b29d15731..3f415ebc9 100644
--- a/src/core/gnunet-service-core_kx.c
+++ b/src/core/gnunet-service-core_kx.c
@@ -675,7 +675,7 @@ process_hello (void *cls, const struct GNUNET_PeerIdentity *peer,
675 struct SetKeyMessage *skm; 675 struct SetKeyMessage *skm;
676 676
677 CHECK_KX (kx); 677 CHECK_KX (kx);
678 if (err_msg != NULL) 678 if (NULL != err_msg)
679 { 679 {
680 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 680 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
681 _("Error in communication with PEERINFO service\n")); 681 _("Error in communication with PEERINFO service\n"));
@@ -687,10 +687,10 @@ process_hello (void *cls, const struct GNUNET_PeerIdentity *peer,
687 &set_key_retry_task, kx); 687 &set_key_retry_task, kx);
688 return; 688 return;
689 } 689 }
690 if (peer == NULL) 690 if (NULL == peer)
691 { 691 {
692 kx->pitr = NULL; 692 kx->pitr = NULL;
693 if (kx->public_key != NULL) 693 if (NULL != kx->public_key)
694 return; /* done here */ 694 return; /* done here */
695 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 695 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
696 "Failed to obtain public key for peer `%4s', delaying processing of SET_KEY\n", 696 "Failed to obtain public key for peer `%4s', delaying processing of SET_KEY\n",
@@ -707,7 +707,7 @@ process_hello (void *cls, const struct GNUNET_PeerIdentity *peer,
707 return; 707 return;
708 } 708 }
709 GNUNET_break (0 == memcmp (peer, &kx->peer, sizeof (struct GNUNET_PeerIdentity))); 709 GNUNET_break (0 == memcmp (peer, &kx->peer, sizeof (struct GNUNET_PeerIdentity)));
710 if (kx->public_key != NULL) 710 if (NULL != kx->public_key)
711 { 711 {
712 /* already have public key, why are we here? */ 712 /* already have public key, why are we here? */
713 GNUNET_break (0); 713 GNUNET_break (0);
@@ -774,7 +774,7 @@ GSC_KX_stop (struct GSC_KeyExchangeInfo *kx)
774{ 774{
775 GNUNET_STATISTICS_update (GSC_stats, gettext_noop ("# key exchanges stopped"), 775 GNUNET_STATISTICS_update (GSC_stats, gettext_noop ("# key exchanges stopped"),
776 1, GNUNET_NO); 776 1, GNUNET_NO);
777 if (kx->pitr != NULL) 777 if (NULL != kx->pitr)
778 { 778 {
779 GNUNET_PEERINFO_iterate_cancel (kx->pitr); 779 GNUNET_PEERINFO_iterate_cancel (kx->pitr);
780 kx->pitr = NULL; 780 kx->pitr = NULL;
@@ -831,7 +831,7 @@ GSC_KX_handle_set_key (struct GSC_KeyExchangeInfo *kx,
831 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 831 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
832 "Core service receives `%s' request from `%4s'.\n", "SET_KEY", 832 "Core service receives `%s' request from `%4s'.\n", "SET_KEY",
833 GNUNET_i2s (&kx->peer)); 833 GNUNET_i2s (&kx->peer));
834 if (kx->public_key == NULL) 834 if (NULL == kx->public_key)
835 { 835 {
836 GNUNET_free_non_null (kx->skm_received); 836 GNUNET_free_non_null (kx->skm_received);
837 kx->skm_received = (struct SetKeyMessage *) GNUNET_copy_message (msg); 837 kx->skm_received = (struct SetKeyMessage *) GNUNET_copy_message (msg);
@@ -926,14 +926,14 @@ GSC_KX_handle_set_key (struct GSC_KeyExchangeInfo *kx,
926 GNUNET_break (0); 926 GNUNET_break (0);
927 break; 927 break;
928 } 928 }
929 if (kx->ping_received != NULL) 929 if (NULL != kx->ping_received)
930 { 930 {
931 ping = kx->ping_received; 931 ping = kx->ping_received;
932 kx->ping_received = NULL; 932 kx->ping_received = NULL;
933 GSC_KX_handle_ping (kx, &ping->header); 933 GSC_KX_handle_ping (kx, &ping->header);
934 GNUNET_free (ping); 934 GNUNET_free (ping);
935 } 935 }
936 if (kx->pong_received != NULL) 936 if (NULL != kx->pong_received)
937 { 937 {
938 pong = kx->pong_received; 938 pong = kx->pong_received;
939 kx->pong_received = NULL; 939 kx->pong_received = NULL;
@@ -1106,7 +1106,7 @@ send_keep_alive (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1106 1106
1107 kx->keep_alive_task = GNUNET_SCHEDULER_NO_TASK; 1107 kx->keep_alive_task = GNUNET_SCHEDULER_NO_TASK;
1108 left = GNUNET_TIME_absolute_get_remaining (kx->timeout); 1108 left = GNUNET_TIME_absolute_get_remaining (kx->timeout);
1109 if (left.rel_value == 0) 1109 if (0 == left.rel_value)
1110 { 1110 {
1111 GNUNET_STATISTICS_update (GSC_stats, 1111 GNUNET_STATISTICS_update (GSC_stats,
1112 gettext_noop ("# sessions terminated by timeout"), 1112 gettext_noop ("# sessions terminated by timeout"),
@@ -1212,7 +1212,7 @@ GSC_KX_handle_pong (struct GSC_KeyExchangeInfo *kx,
1212 uint16_t msize; 1212 uint16_t msize;
1213 1213
1214 msize = ntohs (msg->size); 1214 msize = ntohs (msg->size);
1215 if (msize != sizeof (struct PongMessage)) 1215 if (sizeof (struct PongMessage) != msize)
1216 { 1216 {
1217 GNUNET_break_op (0); 1217 GNUNET_break_op (0);
1218 return; 1218 return;
@@ -1291,8 +1291,8 @@ GSC_KX_handle_pong (struct GSC_KeyExchangeInfo *kx,
1291 GSC_SESSIONS_create (&kx->peer, kx); 1291 GSC_SESSIONS_create (&kx->peer, kx);
1292 CHECK_KX (kx); 1292 CHECK_KX (kx);
1293 schedule_rekey (kx); 1293 schedule_rekey (kx);
1294 GNUNET_assert (kx->keep_alive_task == GNUNET_SCHEDULER_NO_TASK); 1294 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == kx->keep_alive_task);
1295 if (kx->emsg_received != NULL) 1295 if (NULL != kx->emsg_received)
1296 { 1296 {
1297 emsg = kx->emsg_received; 1297 emsg = kx->emsg_received;
1298 kx->emsg_received = NULL; 1298 kx->emsg_received = NULL;
@@ -1333,14 +1333,14 @@ static void
1333send_key (struct GSC_KeyExchangeInfo *kx) 1333send_key (struct GSC_KeyExchangeInfo *kx)
1334{ 1334{
1335 CHECK_KX (kx); 1335 CHECK_KX (kx);
1336 if (kx->retry_set_key_task != GNUNET_SCHEDULER_NO_TASK) 1336 if (GNUNET_SCHEDULER_NO_TASK != kx->retry_set_key_task)
1337 { 1337 {
1338 GNUNET_SCHEDULER_cancel (kx->retry_set_key_task); 1338 GNUNET_SCHEDULER_cancel (kx->retry_set_key_task);
1339 kx->retry_set_key_task = GNUNET_SCHEDULER_NO_TASK; 1339 kx->retry_set_key_task = GNUNET_SCHEDULER_NO_TASK;
1340 } 1340 }
1341 if (KX_STATE_UP == kx->status) 1341 if (KX_STATE_UP == kx->status)
1342 return; /* nothing to do */ 1342 return; /* nothing to do */
1343 if (kx->public_key == NULL) 1343 if (NULL == kx->public_key)
1344 { 1344 {
1345 /* lookup public key, then try again */ 1345 /* lookup public key, then try again */
1346 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1346 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1523,7 +1523,7 @@ GSC_KX_handle_encrypted_message (struct GSC_KeyExchangeInfo *kx,
1523 1, GNUNET_NO); 1523 1, GNUNET_NO);
1524 return; 1524 return;
1525 } 1525 }
1526 if (kx->status == KX_STATE_KEY_RECEIVED) 1526 if (KX_STATE_KEY_RECEIVED == kx->status)
1527 { 1527 {
1528 /* defer */ 1528 /* defer */
1529 GNUNET_free_non_null (kx->ping_received); 1529 GNUNET_free_non_null (kx->ping_received);
@@ -1686,7 +1686,7 @@ GSC_KX_init ()
1686 } 1686 }
1687 my_private_key = GNUNET_CRYPTO_rsa_key_create_from_file (keyfile); 1687 my_private_key = GNUNET_CRYPTO_rsa_key_create_from_file (keyfile);
1688 GNUNET_free (keyfile); 1688 GNUNET_free (keyfile);
1689 if (my_private_key == NULL) 1689 if (NULL == my_private_key)
1690 { 1690 {
1691 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1691 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1692 _("Core service could not access hostkey. Exiting.\n")); 1692 _("Core service could not access hostkey. Exiting.\n"));
@@ -1715,17 +1715,17 @@ GSC_KX_init ()
1715void 1715void
1716GSC_KX_done () 1716GSC_KX_done ()
1717{ 1717{
1718 if (my_private_key != NULL) 1718 if (NULL != my_private_key)
1719 { 1719 {
1720 GNUNET_CRYPTO_rsa_key_free (my_private_key); 1720 GNUNET_CRYPTO_rsa_key_free (my_private_key);
1721 my_private_key = NULL; 1721 my_private_key = NULL;
1722 } 1722 }
1723 if (peerinfo != NULL) 1723 if (NULL != peerinfo)
1724 { 1724 {
1725 GNUNET_PEERINFO_disconnect (peerinfo); 1725 GNUNET_PEERINFO_disconnect (peerinfo);
1726 peerinfo = NULL; 1726 peerinfo = NULL;
1727 } 1727 }
1728 if (mst != NULL) 1728 if (NULL != mst)
1729 { 1729 {
1730 GNUNET_SERVER_mst_destroy (mst); 1730 GNUNET_SERVER_mst_destroy (mst);
1731 mst = NULL; 1731 mst = NULL;