[PATCH] dhcp: only apply dhcp result to service when network available

2014-08-04 Thread Guoqiang Liu
From: Guoqiang Liu guoqiang@archermind.com

network doesn't make sense to P2P, so only apply dhcp result to
service when network available.
---
 src/dhcp.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/dhcp.c b/src/dhcp.c
index 132b787..eaff2ce 100644
--- a/src/dhcp.c
+++ b/src/dhcp.c
@@ -459,7 +459,8 @@ static void lease_available_cb(GDHCPClient *dhcp_client, 
gpointer user_data)
__connman_ipconfig_set_gateway(dhcp-ipconfig, gateway);
}
 
-   if (!apply_lease_available_on_network(dhcp_client, dhcp))
+   if (dhcp-network
+!apply_lease_available_on_network(dhcp_client, dhcp))
return;
 
if (ip_change)
-- 
1.7.9.5

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [PATCH] dhcp: only apply dhcp result to service when network available

2014-08-04 Thread Tomasz Bursztyka

Hi,

+++ b/src/dhcp.c
@@ -459,7 +459,8 @@ static void lease_available_cb(GDHCPClient *dhcp_client, 
gpointer user_data)
__connman_ipconfig_set_gateway(dhcp-ipconfig, gateway);
}
  
-	if (!apply_lease_available_on_network(dhcp_client, dhcp))

+   if (dhcp-network
+!apply_lease_available_on_network(dhcp_client, dhcp))
return;


Indeed, but do the test in apply_lease_available_on_network() preferably.
just a: if (!dhcp-network)
return true;

Thanks,

Tomasz
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [PATCH] dhcp: only apply dhcp result to service when network available

2014-08-04 Thread leonew

Hi Tomasz,

On 08/04/2014 03:52 PM, Tomasz Bursztyka wrote:

Hi,

+++ b/src/dhcp.c
@@ -459,7 +459,8 @@ static void lease_available_cb(GDHCPClient 
*dhcp_client, gpointer user_data)

  __connman_ipconfig_set_gateway(dhcp-ipconfig, gateway);
  }
  -if (!apply_lease_available_on_network(dhcp_client, dhcp))
+if (dhcp-network
+ !apply_lease_available_on_network(dhcp_client, dhcp))
  return;


Indeed, but do the test in apply_lease_available_on_network() preferably.
just a: if (!dhcp-network)
return true;

Here is my understanding:
1 From the name of the function, return true seemed to mean that apply 
lease available on network successful.

In fact. the network is NULL, and it should failed.
2 At the same time, what the function do is about service update. but 
the patch is about P2P.


In consideration of those reasons, I move the code to lease_available_cb.

Best Regards
Guoqiang

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [PATCH] dhcp: only apply dhcp result to service when network available

2014-08-04 Thread Tomasz Bursztyka

Hi,


+++ b/src/dhcp.c
@@ -459,7 +459,8 @@ static void lease_available_cb(GDHCPClient 
*dhcp_client, gpointer user_data)

  __connman_ipconfig_set_gateway(dhcp-ipconfig, gateway);
  }
  -if (!apply_lease_available_on_network(dhcp_client, dhcp))
+if (dhcp-network
+ !apply_lease_available_on_network(dhcp_client, dhcp))
  return;


Indeed, but do the test in apply_lease_available_on_network() 
preferably.

just a: if (!dhcp-network)
return true;

Here is my understanding:
1 From the name of the function, return true seemed to mean that 
apply lease available on network successful.


Don't interpret this, this function is just here because of my 
refactorization of dhcp.c
On network it will try to apply something yes: so it can return true 
or false in this specific case.
If there is no network is silently make the function to poss, so 
returning true.


Exactly as apply_dhcp_invalidate_on_network() does.

Tomasz
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [PATCH] dhcp: only apply dhcp result to service when network available

2014-08-04 Thread Tomasz Bursztyka


If there is no network is silently make the function to poss, so 
returning true.

to pAss
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [PATCH] dhcp: only apply dhcp result to service when network available

2014-08-04 Thread leonew


Don't interpret this, this function is just here because of my 
refactorization of dhcp.c
On network it will try to apply something yes: so it can return true 
or false in this specific case.
If there is no network is silently make the function to poss, so 
returning true.


Exactly as apply_dhcp_invalidate_on_network() does.


Agree with you. I will update the patch.

Thanks
Guoqiang


___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman