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

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

Issue 6525048: code review 6525048: net: protocol specific listen functions return a proper... (Closed)
Left Patch Set: diff -r ad0d92901061 https://go.googlecode.com/hg/ Created 11 years, 4 months ago
Right Patch Set: diff -r 0b46d6fe2f1c https://go.googlecode.com/hg/ Created 11 years, 4 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/iprawsock_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 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 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 "bytes" 10 "bytes"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 b[6] = uint8(seqnum >> 8) // sequence number 199 b[6] = uint8(seqnum >> 8) // sequence number
200 b[7] = uint8(seqnum & 0xff) // sequence number 200 b[7] = uint8(seqnum & 0xff) // sequence number
201 return b 201 return b
202 } 202 }
203 203
204 func parseICMPEchoReply(b []byte) (id, seqnum int) { 204 func parseICMPEchoReply(b []byte) (id, seqnum int) {
205 id = int(b[4])<<8 | int(b[5]) 205 id = int(b[4])<<8 | int(b[5])
206 seqnum = int(b[6])<<8 | int(b[7]) 206 seqnum = int(b[6])<<8 | int(b[7])
207 return 207 return
208 } 208 }
209
210 var ipConnLocalNameTests = []struct {
211 net string
212 laddr *IPAddr
213 }{
214 {"ip4:icmp", &IPAddr{IP: IPv4(127, 0, 0, 1)}},
215 {"ip4:icmp", &IPAddr{}},
216 {"ip4:icmp", nil},
217 }
218
219 func TestIPConnLocalName(t *testing.T) {
220 if os.Getuid() != 0 {
221 t.Logf("skipping test; must be root")
222 return
223 }
224
225 for _, tt := range ipConnLocalNameTests {
226 c, err := ListenIP(tt.net, tt.laddr)
227 if err != nil {
228 t.Errorf("ListenIP failed: %v", err)
229 return
230 }
231 defer c.Close()
232 la := c.LocalAddr()
233 if la == nil {
234 t.Error("IPConn.LocalAddr failed")
235 return
236 }
237 }
238 }
LEFTRIGHT

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