Commit 2d20ded5 authored by Mikio Hara's avatar Mikio Hara

net: add test for RawConn.Control on Windows

This is a followup to https://go-review.googlesource.com/37039.

Updates #19435.

Change-Id: Ia795bd5158d26effa56e897698208ccf73f9e0d2
Reviewed-on: https://go-review.googlesource.com/43693Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent fd25fe60
......@@ -9,8 +9,11 @@ import (
"syscall"
)
// BUG(mikio): On NaCl, Plan 9 and Windows, the Control, Read and
// Write methods of syscall.RawConn are not implemented.
// BUG(mikio): On Windows, the Read and Write methods of
// syscall.RawConn are not implemented.
// BUG(mikio): On NaCl and Plan 9, the Control, Read and Write methods
// of syscall.RawConn are not implemented.
type rawConn struct {
fd *netFD
......
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package net
import (
"syscall"
"testing"
)
func TestRawConn(t *testing.T) {
c, err := newLocalPacketListener("udp")
if err != nil {
t.Fatal(err)
}
defer c.Close()
cc, err := c.(*UDPConn).SyscallConn()
if err != nil {
t.Fatal(err)
}
var operr error
fn := func(s uintptr) {
operr = syscall.SetsockoptInt(syscall.Handle(s), syscall.SOL_SOCKET, syscall.SO_REUSEADDR, 1)
}
err = cc.Control(fn)
if err != nil || operr != nil {
t.Fatal(err, operr)
}
c.Close()
err = cc.Control(fn)
if err == nil {
t.Fatal("should fail")
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment