projects
/
framework
/
connectivity
/
connman.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
14821c6
)
Add more debug statements to DHCP library
author
Marcel Holtmann
<marcel@holtmann.org>
Tue, 17 Aug 2010 10:42:54 +0000
(12:42 +0200)
committer
Marcel Holtmann
<marcel@holtmann.org>
Tue, 17 Aug 2010 10:42:54 +0000
(12:42 +0200)
gdhcp/client.c
patch
|
blob
|
history
diff --git
a/gdhcp/client.c
b/gdhcp/client.c
index
a7bd88a
..
430ecc8
100644
(file)
--- a/
gdhcp/client.c
+++ b/
gdhcp/client.c
@@
-600,6
+600,9
@@
static gboolean request_timeout(gpointer user_data)
{
GDHCPClient *dhcp_client = user_data;
{
GDHCPClient *dhcp_client = user_data;
+ debug(dhcp_client, "request timeout (retries %d)",
+ dhcp_client->retry_times);
+
dhcp_client->retry_times++;
start_request(dhcp_client);
dhcp_client->retry_times++;
start_request(dhcp_client);
@@
-616,6
+619,9
@@
static int switch_listening_mode(GDHCPClient *dhcp_client,
GIOChannel *listener_channel;
int listener_sockfd;
GIOChannel *listener_channel;
int listener_sockfd;
+ debug(dhcp_client, "switch listening mode (%d ==> %d)",
+ dhcp_client->listen_mode, listen_mode);
+
if (dhcp_client->listen_mode == listen_mode)
return 0;
if (dhcp_client->listen_mode == listen_mode)
return 0;
@@
-665,6
+671,9
@@
static int switch_listening_mode(GDHCPClient *dhcp_client,
static void start_request(GDHCPClient *dhcp_client)
{
static void start_request(GDHCPClient *dhcp_client)
{
+ debug(dhcp_client, "start request (retries %d)",
+ dhcp_client->retry_times);
+
if (dhcp_client->retry_times == REQUEST_RETRIES) {
dhcp_client->state = INIT_SELECTING;
if (dhcp_client->retry_times == REQUEST_RETRIES) {
dhcp_client->state = INIT_SELECTING;
@@
-710,6
+719,8
@@
static uint32_t get_lease(struct dhcp_packet *packet)
static void restart_dhcp(GDHCPClient *dhcp_client, int retry_times)
{
static void restart_dhcp(GDHCPClient *dhcp_client, int retry_times)
{
+ debug(dhcp_client, "restart DHCP (retries %d)", retry_times);
+
if (dhcp_client->timeout > 0) {
g_source_remove(dhcp_client->timeout);
dhcp_client->timeout = 0;
if (dhcp_client->timeout > 0) {
g_source_remove(dhcp_client->timeout);
dhcp_client->timeout = 0;
@@
-726,6
+737,8
@@
static gboolean start_rebound_timeout(gpointer user_data)
{
GDHCPClient *dhcp_client = user_data;
{
GDHCPClient *dhcp_client = user_data;
+ debug(dhcp_client, "start rebound timeout");
+
switch_listening_mode(dhcp_client, L2);
dhcp_client->lease_seconds >>= 1;
switch_listening_mode(dhcp_client, L2);
dhcp_client->lease_seconds >>= 1;
@@
-755,6
+768,8
@@
static gboolean start_rebound_timeout(gpointer user_data)
static void start_rebound(GDHCPClient *dhcp_client)
{
static void start_rebound(GDHCPClient *dhcp_client)
{
+ debug(dhcp_client, "start rebound");
+
dhcp_client->state = REBINDING;
dhcp_client->timeout = g_timeout_add_seconds_full(G_PRIORITY_HIGH,
dhcp_client->state = REBINDING;
dhcp_client->timeout = g_timeout_add_seconds_full(G_PRIORITY_HIGH,
@@
-768,6
+783,8
@@
static gboolean start_renew_timeout(gpointer user_data)
{
GDHCPClient *dhcp_client = user_data;
{
GDHCPClient *dhcp_client = user_data;
+ debug(dhcp_client, "start renew timeout");
+
dhcp_client->state = RENEWING;
dhcp_client->lease_seconds >>= 1;
dhcp_client->state = RENEWING;
dhcp_client->lease_seconds >>= 1;
@@
-791,6
+808,8
@@
static gboolean start_renew_timeout(gpointer user_data)
static void start_bound(GDHCPClient *dhcp_client)
{
static void start_bound(GDHCPClient *dhcp_client)
{
+ debug(dhcp_client, "start bound");
+
dhcp_client->state = BOUND;
dhcp_client->timeout = g_timeout_add_seconds_full(G_PRIORITY_HIGH,
dhcp_client->state = BOUND;
dhcp_client->timeout = g_timeout_add_seconds_full(G_PRIORITY_HIGH,
@@
-803,6
+822,8
@@
static gboolean restart_dhcp_timeout(gpointer user_data)
{
GDHCPClient *dhcp_client = user_data;
{
GDHCPClient *dhcp_client = user_data;
+ debug(dhcp_client, "restart DHCP timeout");
+
dhcp_client->ack_retry_times++;
restart_dhcp(dhcp_client, dhcp_client->ack_retry_times);
dhcp_client->ack_retry_times++;
restart_dhcp(dhcp_client, dhcp_client->ack_retry_times);