LEFT | RIGHT |
1 // Copyright 2012 The Go Authors. All rights reserved. | 1 // Copyright 2012 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 // +build darwin freebsd linux openbsd | 5 // +build darwin freebsd linux netbsd openbsd |
6 | 6 |
7 package ipv4_test | 7 package ipv4_test |
8 | 8 |
9 import ( | 9 import ( |
10 "code.google.com/p/go.net/ipv4" | 10 "code.google.com/p/go.net/ipv4" |
11 "net" | 11 "net" |
12 "os" | 12 "os" |
13 "testing" | 13 "testing" |
14 ) | 14 ) |
15 | 15 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 } | 60 } |
61 | 61 |
62 func TestUDPMultipleConnWithMultipleGroupListeners(t *testing.T) { | 62 func TestUDPMultipleConnWithMultipleGroupListeners(t *testing.T) { |
63 if testing.Short() || !*testExternal { | 63 if testing.Short() || !*testExternal { |
64 t.Logf("skipping test to avoid external network") | 64 t.Logf("skipping test to avoid external network") |
65 return | 65 return |
66 } | 66 } |
67 | 67 |
68 for _, tt := range udpMultipleGroupListenerTests { | 68 for _, tt := range udpMultipleGroupListenerTests { |
69 // listen to a group address, actually a wildcard address | 69 // listen to a group address, actually a wildcard address |
70 » » // with resuable port | 70 » » // with reusable port |
71 c1, err := net.ListenPacket("udp4", "224.0.0.0:1024") // see RFC
4727 | 71 c1, err := net.ListenPacket("udp4", "224.0.0.0:1024") // see RFC
4727 |
72 if err != nil { | 72 if err != nil { |
73 t.Fatalf("net.ListenPacket failed: %v", err) | 73 t.Fatalf("net.ListenPacket failed: %v", err) |
74 } | 74 } |
75 defer c1.Close() | 75 defer c1.Close() |
76 | 76 |
77 c2, err := net.ListenPacket("udp4", "224.0.0.0:1024") // see RFC
4727 | 77 c2, err := net.ListenPacket("udp4", "224.0.0.0:1024") // see RFC
4727 |
78 if err != nil { | 78 if err != nil { |
79 t.Fatalf("net.ListenPacket failed: %v", err) | 79 t.Fatalf("net.ListenPacket failed: %v", err) |
80 } | 80 } |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 t.Fatalf("ipv4.RawConn.JoinGroup on %v failed: %v", ifi,
err) | 235 t.Fatalf("ipv4.RawConn.JoinGroup on %v failed: %v", ifi,
err) |
236 } | 236 } |
237 mlt = append(mlt, &ml{r, &ift[i]}) | 237 mlt = append(mlt, &ml{r, &ift[i]}) |
238 } | 238 } |
239 for _, m := range mlt { | 239 for _, m := range mlt { |
240 if err := m.c.LeaveGroup(m.ifi, gaddr); err != nil { | 240 if err := m.c.LeaveGroup(m.ifi, gaddr); err != nil { |
241 t.Fatalf("ipv4.RawConn.LeaveGroup on %v failed: %v", m.i
fi, err) | 241 t.Fatalf("ipv4.RawConn.LeaveGroup on %v failed: %v", m.i
fi, err) |
242 } | 242 } |
243 } | 243 } |
244 } | 244 } |
LEFT | RIGHT |