aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2011-07-18 09:18:19 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2011-07-18 09:18:19 +0000
commit06192010f75ca54c8542b9d88b1306affb2deffe (patch)
tree728a84092a8ddbade55979c85f2f4ef00f9c9f87 /src/transport/gnunet-service-transport.c
parente0de1936ceef28ce8f0b428ff429da112d649b9e (diff)
downloadgnunet-06192010f75ca54c8542b9d88b1306affb2deffe.tar.gz
gnunet-06192010f75ca54c8542b9d88b1306affb2deffe.zip
Diffstat (limited to 'src/transport/gnunet-service-transport.c')
-rw-r--r--src/transport/gnunet-service-transport.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index 94a591147..43b988f83 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -997,7 +997,9 @@ static int update_addr_value (struct ForeignAddressList *fal, uint32_t value , i
997 fal->quality[c].values[1] = fal->quality[c].values[2]; 997 fal->quality[c].values[1] = fal->quality[c].values[2];
998 fal->quality[c].values[2] = value; 998 fal->quality[c].values[2] = value;
999 set = GNUNET_YES; 999 set = GNUNET_YES;
1000#if HAVE_GLPK
1000 ats_modify_problem_state (ats, ATS_QUALITY_UPDATED); 1001 ats_modify_problem_state (ats, ATS_QUALITY_UPDATED);
1002#endif
1001 } 1003 }
1002 } 1004 }
1003 if (set == GNUNET_NO) 1005 if (set == GNUNET_NO)
@@ -1008,7 +1010,9 @@ static int update_addr_value (struct ForeignAddressList *fal, uint32_t value , i
1008 { 1010 {
1009 fal->ressources[c].c = value; 1011 fal->ressources[c].c = value;
1010 set = GNUNET_YES; 1012 set = GNUNET_YES;
1013#if HAVE_GLPK
1011 ats_modify_problem_state (ats, ATS_COST_UPDATED); 1014 ats_modify_problem_state (ats, ATS_COST_UPDATED);
1015#endif
1012 } 1016 }
1013 } 1017 }
1014 } 1018 }
@@ -2506,8 +2510,9 @@ plugin_env_session_end (void *cls,
2506 } 2510 }
2507 GNUNET_free_non_null(pos->ressources); 2511 GNUNET_free_non_null(pos->ressources);
2508 GNUNET_free_non_null(pos->quality); 2512 GNUNET_free_non_null(pos->quality);
2513#if HAVE_GLPK
2509 ats_modify_problem_state (ats, ATS_MODIFIED); 2514 ats_modify_problem_state (ats, ATS_MODIFIED);
2510 2515#endif
2511 if (GNUNET_YES != pos->connected) 2516 if (GNUNET_YES != pos->connected)
2512 { 2517 {
2513 /* nothing else to do, connection was never up... */ 2518 /* nothing else to do, connection was never up... */
@@ -2675,8 +2680,10 @@ notify_clients_connect (const struct GNUNET_PeerIdentity *peer,
2675 /* notify ats about connecting peer */ 2680 /* notify ats about connecting peer */
2676 if ((ats != NULL) && (shutdown_in_progress == GNUNET_NO)) 2681 if ((ats != NULL) && (shutdown_in_progress == GNUNET_NO))
2677 { 2682 {
2683#if HAVE_GLPK
2678 ats_modify_problem_state(ats, ATS_MODIFIED); 2684 ats_modify_problem_state(ats, ATS_MODIFIED);
2679 ats_calculate_bandwidth_distribution (ats, stats); 2685 ats_calculate_bandwidth_distribution (ats, stats);
2686#endif
2680 } 2687 }
2681 cpos = clients; 2688 cpos = clients;
2682 while (cpos != NULL) 2689 while (cpos != NULL)
@@ -2721,8 +2728,10 @@ notify_clients_disconnect (const struct GNUNET_PeerIdentity *peer)
2721 /* notify ats about connecting peer */ 2728 /* notify ats about connecting peer */
2722 if ((ats != NULL) && (shutdown_in_progress == GNUNET_NO)) 2729 if ((ats != NULL) && (shutdown_in_progress == GNUNET_NO))
2723 { 2730 {
2731#if HAVE_GLPK
2724 ats_modify_problem_state(ats, ATS_MODIFIED); 2732 ats_modify_problem_state(ats, ATS_MODIFIED);
2725 ats_calculate_bandwidth_distribution (ats, stats); 2733 ats_calculate_bandwidth_distribution (ats, stats);
2734#endif
2726 } 2735 }
2727 2736
2728 cpos = clients; 2737 cpos = clients;
@@ -4887,9 +4896,9 @@ disconnect_neighbour (struct NeighbourList *n, int check)
4887 n->received_pong = GNUNET_NO; 4896 n->received_pong = GNUNET_NO;
4888 notify_clients_disconnect (&n->id); 4897 notify_clients_disconnect (&n->id);
4889 } 4898 }
4890 4899#if HAVE_GLPK
4891 ats_modify_problem_state(ats, ATS_MODIFIED); 4900 ats_modify_problem_state(ats, ATS_MODIFIED);
4892 4901#endif
4893 /* clean up all plugins, cancel connections and pending transmissions */ 4902 /* clean up all plugins, cancel connections and pending transmissions */
4894 while (NULL != (rpos = n->plugins)) 4903 while (NULL != (rpos = n->plugins))
4895 { 4904 {
@@ -5419,6 +5428,7 @@ plugin_env_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
5419 if ((ntohs(message->type) == GNUNET_MESSAGE_TYPE_TRANSPORT_ATS) && 5428 if ((ntohs(message->type) == GNUNET_MESSAGE_TYPE_TRANSPORT_ATS) &&
5420 (ntohs(message->size) == (sizeof (struct GNUNET_MessageHeader) + sizeof (uint32_t)))) 5429 (ntohs(message->size) == (sizeof (struct GNUNET_MessageHeader) + sizeof (uint32_t))))
5421 { 5430 {
5431#if HAVE_GLPK
5422 uint32_t value = ntohl(*((uint32_t *) &message[1])); 5432 uint32_t value = ntohl(*((uint32_t *) &message[1]));
5423 //GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "GNUNET_MESSAGE_TYPE_TRANSPORT_ATS: %i \n", value); 5433 //GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "GNUNET_MESSAGE_TYPE_TRANSPORT_ATS: %i \n", value);
5424 /* Force ressource and quality update */ 5434 /* Force ressource and quality update */
@@ -5433,6 +5443,7 @@ plugin_env_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
5433 /* Force full rebuild */ 5443 /* Force full rebuild */
5434 if ((value == 1) && (ats != NULL)) 5444 if ((value == 1) && (ats != NULL))
5435 ats_modify_problem_state(ats, ATS_MODIFIED); 5445 ats_modify_problem_state(ats, ATS_MODIFIED);
5446#endif
5436 } 5447 }
5437 5448
5438#if DEBUG_PING_PONG 5449#if DEBUG_PING_PONG
@@ -6311,8 +6322,10 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
6311 GNUNET_SCHEDULER_cancel(ats_task); 6322 GNUNET_SCHEDULER_cancel(ats_task);
6312 ats_task = GNUNET_SCHEDULER_NO_TASK; 6323 ats_task = GNUNET_SCHEDULER_NO_TASK;
6313 } 6324 }
6325#if HAVE_GLPK
6314 if (ats != NULL) 6326 if (ats != NULL)
6315 ats_shutdown (ats); 6327 ats_shutdown (ats);
6328#endif
6316 6329
6317 /* free 'chvc' data structure */ 6330 /* free 'chvc' data structure */
6318 while (NULL != (chvc = chvc_head)) 6331 while (NULL != (chvc = chvc_head))
@@ -6503,7 +6516,9 @@ schedule_ats (void *cls,
6503#if DEBUG_ATS 6516#if DEBUG_ATS
6504 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Running scheduled calculation\n"); 6517 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Running scheduled calculation\n");
6505#endif 6518#endif
6519#if HAVE_GLPK
6506 ats_calculate_bandwidth_distribution (ats, stats); 6520 ats_calculate_bandwidth_distribution (ats, stats);
6521#endif
6507 last_ats_execution = GNUNET_TIME_absolute_get(); 6522 last_ats_execution = GNUNET_TIME_absolute_get();
6508 6523
6509 ats_task = GNUNET_SCHEDULER_add_delayed (ats_regular_interval, 6524 ats_task = GNUNET_SCHEDULER_add_delayed (ats_regular_interval,
@@ -6656,12 +6671,13 @@ run (void *cls,
6656 int co; 6671 int co;
6657 char * section; 6672 char * section;
6658 unsigned long long value; 6673 unsigned long long value;
6659 6674#if HAVE_GLPK
6660 double D = 1.0; 6675 double D = 1.0;
6661 double U = 1.0; 6676 double U = 1.0;
6662 double R = 1.0; 6677 double R = 1.0;
6663 int v_b_min = 64000; 6678 int v_b_min = 64000;
6664 int v_n_min = 5; 6679 int v_n_min = 5;
6680#endif
6665 6681
6666 ats_minimum_interval = ATS_MIN_INTERVAL; 6682 ats_minimum_interval = ATS_MIN_INTERVAL;
6667 ats_regular_interval = ATS_EXEC_INTERVAL; 6683 ats_regular_interval = ATS_EXEC_INTERVAL;
@@ -6704,11 +6720,12 @@ run (void *cls,
6704 } 6720 }
6705 GNUNET_free (section); 6721 GNUNET_free (section);
6706 } 6722 }
6707 6723#if HAVE_GLPK
6708 ats = ats_init (D, U, R, v_b_min, v_n_min, 6724 ats = ats_init (D, U, R, v_b_min, v_n_min,
6709 ATS_MAX_ITERATIONS, ATS_MAX_EXEC_DURATION, 6725 ATS_MAX_ITERATIONS, ATS_MAX_EXEC_DURATION,
6710 create_ats_information, 6726 create_ats_information,
6711 ats_result_cb); 6727 ats_result_cb);
6728#endif
6712 6729
6713 int log_problem = GNUNET_NO; 6730 int log_problem = GNUNET_NO;
6714 int log_solution = GNUNET_NO; 6731 int log_solution = GNUNET_NO;
@@ -6753,13 +6770,14 @@ run (void *cls,
6753 "transport", 6770 "transport",
6754 "ATS_MIN_INTERVAL", 6771 "ATS_MIN_INTERVAL",
6755 &ats_minimum_interval)); 6772 &ats_minimum_interval));
6773#if HAVE_GLPK
6756 ats_set_logging_options (ats, 6774 ats_set_logging_options (ats,
6757 minimum_addresses, 6775 minimum_addresses,
6758 minimum_peers, 6776 minimum_peers,
6759 overwrite_dump, 6777 overwrite_dump,
6760 log_solution, 6778 log_solution,
6761 log_problem); 6779 log_problem);
6762 6780#endif
6763 if (ats != NULL) 6781 if (ats != NULL)
6764 ats_task = GNUNET_SCHEDULER_add_now (&schedule_ats, ats); 6782 ats_task = GNUNET_SCHEDULER_add_now (&schedule_ats, ats);
6765 6783