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

Issue 6098047: code review 6098047: net: consolidate common socket functions (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 1 month ago by dave
Modified:
13 years ago
Reviewers:
CC:
golang-dev, rsc
Visibility:
Public.

Description

net: consolidate common socket functions In resolving 3507, the fix had to be applied individually to the four *Conn types, tcp, udp, rawip and unix, due to the duplicate code in each Conn type. This CL consolidates the common net.Conn methods that all four *Conn types implement into a base conn type. Pros: * The fix for 3507 would have only needed to be applied to one method. Further improvements, such as possibly removing the c.fd != nil check in c.ok(), would benefit from this CL. * Nearly 300 lines removed from the net package. * The public interface and documentation are not changed. * I think this is an excellent example of the power of embedding. Cons: * The net package is already distributed over many files, this CL adds another place to look. * The fix for 3507 was a total of 16 lines changed, this follow up CL could be considered to be an overreaction as new Conn types are unlikely to be added in the near future.

Patch Set 1 #

Patch Set 2 : diff -r 5f24ff99b5f1 https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r 5f24ff99b5f1 https://go.googlecode.com/hg/ #

Patch Set 4 : diff -r 5f24ff99b5f1 https://go.googlecode.com/hg/ #

Patch Set 5 : diff -r cc8a35781b5e https://go.googlecode.com/hg/ #

Patch Set 6 : diff -r cc8a35781b5e https://go.googlecode.com/hg/ #

Patch Set 7 : diff -r cc8a35781b5e https://go.googlecode.com/hg/ #

Patch Set 8 : diff -r 453e47cc0788 https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+118 lines, -377 lines) Patch
M src/pkg/net/iprawsock_posix.go View 1 3 chunks +2 lines, -93 lines 0 comments Download
A src/pkg/net/net_posix.go View 1 2 3 1 chunk +110 lines, -0 lines 0 comments Download
M src/pkg/net/tcpsock_posix.go View 1 4 chunks +2 lines, -93 lines 0 comments Download
M src/pkg/net/udpsock_posix.go View 1 3 chunks +2 lines, -95 lines 0 comments Download
M src/pkg/net/unixsock_posix.go View 1 2 chunks +2 lines, -96 lines 0 comments Download

Messages

Total messages: 8
dave_cheney.net
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://go.googlecode.com/hg/
13 years, 1 month ago (2012-04-24 13:16:43 UTC) #1
dave_cheney.net
Discussion continued from https://groups.google.com/d/topic/golang-dev/rqRnYze6gyQ/discussion With reference to the godoc output, I have diffed the output ...
13 years, 1 month ago (2012-04-24 13:28:05 UTC) #2
rsc
LGTM
13 years, 1 month ago (2012-04-25 01:40:11 UTC) #3
rsc
This is fantastic. I've wanted this to happen from basically the day that code got ...
13 years, 1 month ago (2012-04-25 01:40:44 UTC) #4
dave_cheney.net
My pleasure, hopefully it will make the remaining code easier to maintain. Regarding the comments ...
13 years, 1 month ago (2012-04-25 01:49:13 UTC) #5
rsc
On Tue, Apr 24, 2012 at 21:49, Dave Cheney <dave@cheney.net> wrote: > Regarding the comments ...
13 years, 1 month ago (2012-04-25 02:10:24 UTC) #6
dave_cheney.net
Thank you for your feedback. I plan to submit this change tomorrow (friday) night.
13 years, 1 month ago (2012-04-26 10:02:38 UTC) #7
dave_cheney.net
13 years ago (2012-04-27 12:17:33 UTC) #8
*** Submitted as http://code.google.com/p/go/source/detail?r=fc4a62e14aba ***

net: consolidate common socket functions

In resolving 3507, the fix had to be applied individually to
the four *Conn types, tcp, udp, rawip and unix, due to the
duplicate code in each Conn type.

This CL consolidates the common net.Conn methods that all four
*Conn types implement into a base conn type.


Pros:
* The fix for 3507 would have only needed to be applied to one
method. Further improvements, such as possibly removing the
c.fd != nil check in c.ok(), would benefit from this CL.
* Nearly 300 lines removed from the net package.
* The public interface and documentation are not changed.
* I think this is an excellent example of the power of embedding.

Cons:
* The net package is already distributed over many files, this
CL adds another place to look.
* The fix for 3507 was a total of 16 lines changed, this follow
up CL could be considered to be an overreaction as new Conn types
are unlikely to be added in the near future.

R=golang-dev, rsc
CC=golang-dev
http://codereview.appspot.com/6098047
Sign in to reply to this message.

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