diff options
Diffstat (limited to 'src/mesh/gnunet-service-mesh_new.c')
-rw-r--r-- | src/mesh/gnunet-service-mesh_new.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/src/mesh/gnunet-service-mesh_new.c b/src/mesh/gnunet-service-mesh_new.c index abec7de1c..0e1eda15c 100644 --- a/src/mesh/gnunet-service-mesh_new.c +++ b/src/mesh/gnunet-service-mesh_new.c | |||
@@ -708,13 +708,24 @@ regex_iterator (void *cls, const struct GNUNET_HashCode *key, const char *proof, | |||
708 | size_t size; | 708 | size_t size; |
709 | size_t len; | 709 | size_t len; |
710 | unsigned int i; | 710 | unsigned int i; |
711 | unsigned int offset; | ||
711 | char *aux; | 712 | char *aux; |
712 | 713 | ||
714 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
715 | " regex dht put for state %s\n", | ||
716 | GNUNET_h2s(key)); | ||
717 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
718 | " proof: %s\n", | ||
719 | proof); | ||
720 | |||
713 | opt = GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE; | 721 | opt = GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE; |
714 | if (GNUNET_YES == accepting) | 722 | if (GNUNET_YES == accepting) |
715 | { | 723 | { |
716 | struct MeshRegexAccept block; | 724 | struct MeshRegexAccept block; |
717 | 725 | ||
726 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
727 | " state %s is accepting, putting own id\n", | ||
728 | GNUNET_h2s(key)); | ||
718 | size = sizeof (block); | 729 | size = sizeof (block); |
719 | block.key = *key; | 730 | block.key = *key; |
720 | block.id = my_full_id; | 731 | block.id = my_full_id; |
@@ -749,11 +760,19 @@ regex_iterator (void *cls, const struct GNUNET_HashCode *key, const char *proof, | |||
749 | */ | 760 | */ |
750 | for (i = 0; i < num_edges; i++) | 761 | for (i = 0; i < num_edges; i++) |
751 | { | 762 | { |
763 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
764 | " edge %s towards %s\n", | ||
765 | edges[i].label, | ||
766 | GNUNET_h2s(&edges[i].destination)); | ||
767 | |||
752 | /* aux points at the end of the last block */ | 768 | /* aux points at the end of the last block */ |
753 | block_edge = (struct MeshRegexEdge *) aux; | ||
754 | len = strlen (edges[i].label); | 769 | len = strlen (edges[i].label); |
755 | size += sizeof (struct MeshRegexEdge) + len; | 770 | size += sizeof (struct MeshRegexEdge) + len; |
771 | // Calculate offset FIXME is this ok? use size instead? | ||
772 | offset = aux - (char *) block; | ||
756 | block = GNUNET_realloc (block, size); | 773 | block = GNUNET_realloc (block, size); |
774 | aux = &((char *) block)[offset]; | ||
775 | block_edge = (struct MeshRegexEdge *) aux; | ||
757 | block_edge->key = edges[i].destination; | 776 | block_edge->key = edges[i].destination; |
758 | block_edge->n_token = htonl (len); | 777 | block_edge->n_token = htonl (len); |
759 | aux = (char *) &block_edge[1]; | 778 | aux = (char *) &block_edge[1]; |
@@ -784,9 +803,11 @@ regex_put (const char *regex) | |||
784 | { | 803 | { |
785 | struct GNUNET_REGEX_Automaton *dfa; | 804 | struct GNUNET_REGEX_Automaton *dfa; |
786 | 805 | ||
806 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "regex_put (%s) start\n", regex); | ||
787 | dfa = GNUNET_REGEX_construct_dfa (regex, strlen(regex)); | 807 | dfa = GNUNET_REGEX_construct_dfa (regex, strlen(regex)); |
788 | GNUNET_REGEX_iterate_all_edges (dfa, ®ex_iterator, NULL); | 808 | GNUNET_REGEX_iterate_all_edges (dfa, ®ex_iterator, NULL); |
789 | GNUNET_REGEX_automaton_destroy (dfa); | 809 | GNUNET_REGEX_automaton_destroy (dfa); |
810 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "regex_put (%s) end\n", regex); | ||
790 | 811 | ||
791 | } | 812 | } |
792 | 813 | ||
@@ -4184,6 +4205,14 @@ dht_get_string_handler (void *cls, struct GNUNET_TIME_Absolute exp, | |||
4184 | size_t len; | 4205 | size_t len; |
4185 | 4206 | ||
4186 | // FIXME: does proof have to be NULL terminated? | 4207 | // FIXME: does proof have to be NULL terminated? |
4208 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
4209 | "*******************************\n"); | ||
4210 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
4211 | "DHT GET STRING RETURNED RESULTS\n"); | ||
4212 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
4213 | " key: %s\n"); | ||
4214 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
4215 | "DHT GET STRING RETURNED RESULTS\n"); | ||
4187 | proof = (char *) &block[1]; | 4216 | proof = (char *) &block[1]; |
4188 | if (GNUNET_OK != GNUNET_REGEX_check_proof (proof, key)) | 4217 | if (GNUNET_OK != GNUNET_REGEX_check_proof (proof, key)) |
4189 | { | 4218 | { |
@@ -4973,7 +5002,7 @@ handle_local_connect_by_string (void *cls, struct GNUNET_SERVER_Client *client, | |||
4973 | size_t size; | 5002 | size_t size; |
4974 | size_t len; | 5003 | size_t len; |
4975 | 5004 | ||
4976 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "connect by string started\n"); | 5005 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connect by string started\n"); |
4977 | msg = (struct GNUNET_MESH_ConnectPeerByString *) message; | 5006 | msg = (struct GNUNET_MESH_ConnectPeerByString *) message; |
4978 | size = htons (message->size); | 5007 | size = htons (message->size); |
4979 | 5008 | ||