Don't create TIME-WAIT sockets in CreateSocketPair.

Some tests create lots of socket pairs, and the resulting
TIME-WAIT sockets can cause subsequent tests to fail when
binding.

Change-Id: Ib0ab1722cfa9891d177a805a84807c6f58550dd4
diff --git a/net/test/net_test.py b/net/test/net_test.py
index 5c5a4c5..f108aa8 100755
--- a/net/test/net_test.py
+++ b/net/test/net_test.py
@@ -151,6 +151,10 @@
   return s
 
 
+def DisableLinger(sock):
+  sock.setsockopt(SOL_SOCKET, SO_LINGER, struct.pack("ii", 1, 0))
+
+
 def CreateSocketPair(family, socktype, addr):
   clientsock = socket(family, socktype, 0)
   listensock = socket(family, socktype, 0)
@@ -159,6 +163,9 @@
   listensock.listen(1)
   clientsock.connect(addr)
   acceptedsock, _ = listensock.accept()
+  DisableLinger(clientsock)
+  DisableLinger(acceptedsock)
+  listensock.close()
   return clientsock, acceptedsock