]> Cypherpunks repositories - gostls13.git/commitdiff
net: improve ExampleUDPConn_WriteTo docs
authorMikio Hara <mikioh.mikioh@gmail.com>
Sun, 24 Jun 2018 17:08:52 +0000 (02:08 +0900)
committerMikio Hara <mikioh.mikioh@gmail.com>
Tue, 26 Jun 2018 21:30:43 +0000 (21:30 +0000)
Also updates comment on isConnected field of netFD for clarification.

Change-Id: Icb1b0332e3b4c7802eae00ddc26cd5ba54c82dc2
Reviewed-on: https://go-review.googlesource.com/120955
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/net/example_test.go
src/net/fd_unix.go
src/net/fd_windows.go
src/net/net_fake.go

index 8126a28404a41d6e4c732e011da2ecb0f126fd94..e4d732e68a16f326a31082b475ab5ada5ed3b700 100644 (file)
@@ -121,7 +121,8 @@ func ExampleIPv4Mask() {
 }
 
 func ExampleUDPConn_WriteTo() {
-       // Create connection in non-pre-connected state
+       // Unlike Dial, ListenPacket creates a connection without any
+       // association with peers.
        conn, err := net.ListenPacket("udp", ":0")
        if err != nil {
                log.Fatal(err)
@@ -133,7 +134,7 @@ func ExampleUDPConn_WriteTo() {
                log.Fatal(err)
        }
 
-       // Write data to the desired address
+       // The connection can write data to the desired address.
        _, err = conn.WriteTo([]byte("data"), dst)
        if err != nil {
                log.Fatal(err)
index 06439ee2003b764fe19e20e6010b56ae221030ce..055ecf0336b76d6e1caf07ce5fe0d98fdd085405 100644 (file)
@@ -22,7 +22,7 @@ type netFD struct {
        // immutable until Close
        family      int
        sotype      int
-       isConnected bool
+       isConnected bool // handshake completed or use of association with peer
        net         string
        laddr       Addr
        raddr       Addr
index 8a91138a42ca8ad99e1b1ede401bccb18a75f8aa..3cc4c7a6a2267746042df2cd8a527ab66d524507 100644 (file)
@@ -32,7 +32,7 @@ type netFD struct {
        // immutable until Close
        family      int
        sotype      int
-       isConnected bool
+       isConnected bool // handshake completed or use of association with peer
        net         string
        laddr       Addr
        raddr       Addr
index f7595d9bb4bcfdacb45dd7adc783d9f094787c73..0c48dd5c03bb47ead18b5571a1c635865ca83dd4 100644 (file)
@@ -50,7 +50,7 @@ type netFD struct {
 
        // unused
        pfd         poll.FD
-       isConnected bool
+       isConnected bool // handshake completed or use of association with peer
 }
 
 // socket returns a network file descriptor that is ready for