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

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

Issue 6479053: code review 6479053: net: fix nil pointer defererence in selfConnect for TCP (Closed)
Left Patch Set: diff -r ca5e20f93081 https://code.google.com/p/go Created 11 years, 7 months ago
Right Patch Set: diff -r 3181682928c9 https://code.google.com/p/go Created 11 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 | src/pkg/net/tcpsock_posix.go » ('j') | 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 2012 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 // +build darwin freebsd linux netbsd openbsd windows
6
7 package net
8
9 import (
10 "syscall"
11 "testing"
12 )
13
14 var tcpSelfConnectTests = []struct {
15 fd *netFD
16 err error
17 ok bool
18 }{
19 {&netFD{laddr: nullProtocolAddr(syscall.AF_INET, syscall.SOCK_STREAM), r addr: nullProtocolAddr(syscall.AF_INET, syscall.SOCK_STREAM)}, nil, true},
20 {&netFD{laddr: &TCPAddr{IP: IPv4(127, 0, 0, 1), Port: 1024}, raddr: &TCP Addr{IP: IPv4(127, 0, 0, 1), Port: 1024}}, nil, true},
21 {&netFD{laddr: &TCPAddr{IP: IPv4(127, 0, 0, 1), Port: 1024}, raddr: &TCP Addr{IP: IPv4(127, 0, 0, 2), Port: 1023}}, nil, false},
22 {&netFD{laddr: &TCPAddr{IP: IPv4(127, 0, 0, 1), Port: 1024}, raddr: &TCP Addr{IP: IPv4(127, 0, 0, 1), Port: 1023}}, nil, false},
23 {&netFD{laddr: &TCPAddr{IP: IPv4(127, 0, 0, 1), Port: 1024}, raddr: &TCP Addr{IP: IPv4(127, 0, 0, 1), Port: 1024}}, errClosing, false},
24 }
25
26 func TestTCPSelfConnect(t *testing.T) {
27 for _, tt := range tcpSelfConnectTests {
28 if ok := selfConnect(tt.fd, tt.err); ok != tt.ok {
29 t.Fatalf("selfConnect = %v; want %v", ok, tt.ok)
30 }
31 }
32 }
LEFTRIGHT

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