Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(274)

Delta Between Two Patch Sets: src/pkg/net/unicast_posix_test.go

Issue 13050043: code review 13050043: net: fix garbage connection close in dual stack tests (Closed)
Left Patch Set: Created 10 years, 7 months ago
Right Patch Set: diff -r 8d94debb8662 https://code.google.com/p/go Created 10 years, 7 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2011 The Go Authors. All rights reserved. 1 // Copyright 2011 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 !plan9 5 // +build !plan9
6 6
7 package net 7 package net
8 8
9 import ( 9 import (
10 "runtime" 10 "runtime"
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 t.Fatalf("Unexpected network: %q", net) 342 t.Fatalf("Unexpected network: %q", net)
343 } 343 }
344 } 344 }
345 345
346 func checkDualStackSecondListener(t *testing.T, net, laddr string, xerr, err err or, l interface{}) { 346 func checkDualStackSecondListener(t *testing.T, net, laddr string, xerr, err err or, l interface{}) {
347 switch net { 347 switch net {
348 case "tcp", "tcp4", "tcp6": 348 case "tcp", "tcp4", "tcp6":
349 if xerr == nil && err != nil || xerr != nil && err == nil { 349 if xerr == nil && err != nil || xerr != nil && err == nil {
350 t.Fatalf("Second Listen(%q, %q) returns %v, expected %v" , net, laddr, err, xerr) 350 t.Fatalf("Second Listen(%q, %q) returns %v, expected %v" , net, laddr, err, xerr)
351 } 351 }
352 » » l.(*TCPListener).Close() 352 » » if err == nil {
353 » » » l.(*TCPListener).Close()
354 » » }
353 case "udp", "udp4", "udp6": 355 case "udp", "udp4", "udp6":
354 if xerr == nil && err != nil || xerr != nil && err == nil { 356 if xerr == nil && err != nil || xerr != nil && err == nil {
355 t.Fatalf("Second ListenPacket(%q, %q) returns %v, expect ed %v", net, laddr, err, xerr) 357 t.Fatalf("Second ListenPacket(%q, %q) returns %v, expect ed %v", net, laddr, err, xerr)
356 } 358 }
357 » » l.(*UDPConn).Close() 359 » » if err == nil {
360 » » » l.(*UDPConn).Close()
361 » » }
358 default: 362 default:
359 t.Fatalf("Unexpected network: %q", net) 363 t.Fatalf("Unexpected network: %q", net)
360 } 364 }
361 } 365 }
362 366
363 func checkDualStackAddrFamily(t *testing.T, net, laddr string, fd *netFD) { 367 func checkDualStackAddrFamily(t *testing.T, net, laddr string, fd *netFD) {
364 switch a := fd.laddr.(type) { 368 switch a := fd.laddr.(type) {
365 case *TCPAddr: 369 case *TCPAddr:
366 // If a node under test supports both IPv6 capability 370 // If a node under test supports both IPv6 capability
367 // and IPv6 IPv4-mapping capability, we can assume 371 // and IPv6 IPv4-mapping capability, we can assume
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 if ln, err := ListenTCP("tcp", nil); err == nil { 454 if ln, err := ListenTCP("tcp", nil); err == nil {
451 ln.Close() 455 ln.Close()
452 } 456 }
453 if ln, err := ListenUDP("udp", nil); err == nil { 457 if ln, err := ListenUDP("udp", nil); err == nil {
454 ln.Close() 458 ln.Close()
455 } 459 }
456 if ln, err := ListenIP("ip:icmp", nil); err == nil { 460 if ln, err := ListenIP("ip:icmp", nil); err == nil {
457 ln.Close() 461 ln.Close()
458 } 462 }
459 } 463 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b