Author: fmueller
Date: Thu Jul 22 08:09:59 2010
New Revision: 8981

URL: http://svn.slimdevices.com/jive?rev=8981&view=rev
Log:
Bug: n/a 
Description: Network health check: Added arping test to check if our ip address 
is already taken by another device. 

Modified:
    
7.6/trunk/squeezeplay/src/squeezeplay_squeezeos/share/jive/net/Networking.lua

Modified: 
7.6/trunk/squeezeplay/src/squeezeplay_squeezeos/share/jive/net/Networking.lua
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay_squeezeos/share/jive/net/Networking.lua?rev=8981&r1=8980&r2=8981&view=diff
==============================================================================
--- 
7.6/trunk/squeezeplay/src/squeezeplay_squeezeos/share/jive/net/Networking.lua 
(original)
+++ 
7.6/trunk/squeezeplay/src/squeezeplay_squeezeos/share/jive/net/Networking.lua 
Thu Jul 22 08:09:59 2010
@@ -2036,6 +2036,35 @@
                        return
                end
 
+               -- Arping our own ip address
+               callback(true, 0, "NET_INFO_ARPING", 
tostring(status.ip_address))
+
+               -- Arping
+               local arpingOK = false
+               local arpingProc = Process(jnt, "arping -I " .. self:getName() 
.. " -f -c 2 -w 5 " .. status.ip_address .. " 2>&1")
+               arpingProc:read(function(chunk)
+                       if chunk then
+                               if string.match(chunk, "Received 0 reply") then
+                                       arpingOK = true
+                               end
+                       else
+                               if arpingOK then
+                                       callback(true, 0, "NET_INFO_ARPING_OK")
+                               else
+                                       callback(false, -1, 
"NET_ERROR_ARPING_NOT_OK", tostring(status.ip_address))
+                               end
+                       end
+               end)
+
+               -- Wait until arping has finished
+               while arpingProc:status() ~= "dead" do
+                       Task:yield()
+               end
+
+               if not arpingOK then
+                       return
+               end
+
                -- Get ip of SN
                local server_ip, err
                if DNS:isip(server_name) then

_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins

Reply via email to