Commit 3970d2fd authored by Rob Pike's avatar Rob Pike

net: panic if sockaddrToTCP returns nil incorrectly

Part of diagnosing the selfConnect bug
TBR=dsymonds

R=golang-dev
CC=golang-dev
https://golang.org/cl/5687057
parent 2155a040
......@@ -9,6 +9,7 @@
package net
import (
"fmt"
"io"
"os"
"syscall"
......@@ -26,6 +27,12 @@ func sockaddrToTCP(sa syscall.Sockaddr) Addr {
return &TCPAddr{sa.Addr[0:], sa.Port}
case *syscall.SockaddrInet6:
return &TCPAddr{sa.Addr[0:], sa.Port}
default:
if sa != nil {
// TODO(r): Diagnose when we will turn a non-nil sockaddr into a nil.
// Part of diagnosing the selfConnect bug.
panic(fmt.Sprintf("unexpected type in sockaddrToTCP: %T", sa))
}
}
return nil
}
......
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