From 595de22bc25e58fde14f55ae98d62415ecef9407 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 9 Dec 2010 13:11:49 +0200 Subject: [PATCH] service: __connman_service_notify() prototype change In preparation for the IPv6 only support, this makes the code more readable. --- src/connman.h | 2 +- src/ipconfig.c | 8 +++++++- src/service.c | 4 +--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/connman.h b/src/connman.h index 4fa9050..9b8fcc7 100644 --- a/src/connman.h +++ b/src/connman.h @@ -510,7 +510,7 @@ void __connman_service_set_proxy_autoconfig(struct connman_service *service, void __connman_service_set_passphrase(struct connman_service *service, const char* passphrase); -void __connman_service_notify(struct connman_ipconfig *ipconfig, +void __connman_service_notify(struct connman_service *service, unsigned int rx_packets, unsigned int tx_packets, unsigned int rx_bytes, unsigned int tx_bytes, unsigned int rx_error, unsigned int tx_error, diff --git a/src/ipconfig.c b/src/ipconfig.c index fe99b81..c6e33ec 100644 --- a/src/ipconfig.c +++ b/src/ipconfig.c @@ -423,6 +423,8 @@ static void __connman_ipconfig_lower_down(struct connman_ipdevice *ipdevice) static void update_stats(struct connman_ipdevice *ipdevice, struct rtnl_link_stats *stats) { + struct connman_service *service; + if (stats->rx_packets == 0 && stats->tx_packets == 0) return; @@ -434,6 +436,10 @@ static void update_stats(struct connman_ipdevice *ipdevice, if (ipdevice->config == NULL) return; + service = connman_ipconfig_get_data(ipdevice->config); + if (service == NULL) + return; + ipdevice->rx_packets = stats->rx_packets; ipdevice->tx_packets = stats->tx_packets; ipdevice->rx_bytes = stats->rx_bytes; @@ -443,7 +449,7 @@ static void update_stats(struct connman_ipdevice *ipdevice, ipdevice->rx_dropped = stats->rx_dropped; ipdevice->tx_dropped = stats->tx_dropped; - __connman_service_notify(ipdevice->config, + __connman_service_notify(service, ipdevice->rx_packets, ipdevice->tx_packets, ipdevice->rx_bytes, ipdevice->tx_bytes, ipdevice->rx_errors, ipdevice->tx_errors, diff --git a/src/service.c b/src/service.c index 626cd31..ba5b288 100644 --- a/src/service.c +++ b/src/service.c @@ -1223,13 +1223,12 @@ static void stats_update(struct connman_service *service, stats->data.time = stats->data_last.time + seconds; } -void __connman_service_notify(struct connman_ipconfig *ipconfig, +void __connman_service_notify(struct connman_service *service, unsigned int rx_packets, unsigned int tx_packets, unsigned int rx_bytes, unsigned int tx_bytes, unsigned int rx_errors, unsigned int tx_errors, unsigned int rx_dropped, unsigned int tx_dropped) { - struct connman_service *service; GHashTableIter iter; gpointer key, value; const char *counter; @@ -1237,7 +1236,6 @@ void __connman_service_notify(struct connman_ipconfig *ipconfig, struct connman_stats_data *data; int err; - service = connman_ipconfig_get_data(ipconfig); if (service == NULL) return; -- 2.7.4