net-test: close() fixes for neighbour_test.py
Test: on UML
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I0935796caf96fb9a71d1ec26ed41a5c70edadf3b
diff --git a/net/test/neighbour_test.py b/net/test/neighbour_test.py
index ac15897..74b1156 100755
--- a/net/test/neighbour_test.py
+++ b/net/test/neighbour_test.py
@@ -116,6 +116,9 @@
# so as not to affect other tests.
self.ChangeRouterNudState(4, NUD_PERMANENT)
+ self.sock.close()
+ self.sock = None
+
def ChangeRouterNudState(self, version, state):
router = self._RouterAddress(self.netid, version)
macaddr = self.RouterMacAddress(self.netid)
@@ -268,6 +271,7 @@
# Send a packet, and verify we go into DELAY and then to PROBE.
s.send(net_test.UDP_PAYLOAD)
+ s.close()
self.assertNeighbourState(NUD_DELAY, router6)
self.SleepMs(self.DELAY_TIME_MS * 1.1)
self.assertNeighbourState(NUD_PROBE, router6)
@@ -323,7 +327,7 @@
time.sleep(1)
# Send another packet and expect a multicast NS.
- self.SendDnsRequest(net_test.IPV6_ADDR)
+ self.SendDnsRequest(net_test.IPV6_ADDR).close()
self.ExpectMulticastNS(router6)
# Receive a unicast NA with the R flag set to 0.
@@ -351,7 +355,7 @@
self.SetUnicastSolicit(proto, iface, self.UCAST_SOLICIT_LARGE)
# Send a packet and check that we go into DELAY.
- self.SendDnsRequest(ip_addr)
+ self.SendDnsRequest(ip_addr).close()
self.assertNeighbourState(NUD_DELAY, router)
# Probing 4 times but no reponse