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

Issue 5707044: code review 5707044: net/rpc: API changes, all documentation (Closed)

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

Description

net/rpc: API changes, all documentation except for hiding one type that is only used internally. Fixes issue 2944.

Patch Set 1 #

Patch Set 2 : diff -r 1c2e5d6d7660 https://code.google.com/p/go/ #

Patch Set 3 : diff -r 1c2e5d6d7660 https://code.google.com/p/go/ #

Total comments: 1

Patch Set 4 : diff -r eabeb88b4bb7 https://code.google.com/p/go/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+25 lines, -14 lines) Patch
M src/pkg/net/rpc/server.go View 1 2 3 6 chunks +25 lines, -14 lines 0 comments Download

Messages

Total messages: 6
r
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go/
12 years, 1 month ago (2012-02-28 09:28:01 UTC) #1
rsc
LGTM http://codereview.appspot.com/5707044/diff/2002/src/pkg/net/rpc/server.go File src/pkg/net/rpc/server.go (right): http://codereview.appspot.com/5707044/diff/2002/src/pkg/net/rpc/server.go#newcode288 src/pkg/net/rpc/server.go:288: // Reply type must be exported/ s;/;.;
12 years, 1 month ago (2012-02-28 17:29:52 UTC) #2
kevlar
FYI Could a codec not need this type to be able to encode or skip ...
12 years, 1 month ago (2012-02-28 18:13:23 UTC) #3
r
*** Submitted as http://code.google.com/p/go/source/detail?r=b1838c15bcfa *** net/rpc: API changes, all documentation except for hiding one type ...
12 years, 1 month ago (2012-02-28 20:34:34 UTC) #4
r2
On 29/02/2012, at 5:13 AM, Kyle Lemons wrote: > FYI > > Could a codec ...
12 years, 1 month ago (2012-02-28 20:34:39 UTC) #5
rsc
12 years, 1 month ago (2012-02-28 20:40:00 UTC) #6
> Could a codec not need this type to be able to encode or skip an empty
> message?

no, it's fine.  only the rpc library uses that type.

also, just to confirm that *int reply does not cause a problem,
this program works.

package main

import (
	"net"
	"log"
	"fmt"
	"net/http"
	"net/rpc"
)

type Args struct {
	A, B int
}

type Arith int

func (t *Arith) Multiply(args *Args, reply *int) error {
	*reply = args.A * args.B
	return nil
}

func main() {
	arith := new(Arith)
	rpc.Register(arith)
	rpc.HandleHTTP()
	l, e := net.Listen("tcp", "localhost:1234")
	if e != nil {
		log.Fatal("listen error:", e)
	}
	go http.Serve(l, nil)

	client, err := rpc.DialHTTP("tcp", "localhost:1234")
	if err != nil {
		log.Fatal("dialing:", err)
	}

	// Synchronous call
	args := &Args{7, 8}
	var reply int
	err = client.Call("Arith.Maltiply", args, &reply)
	if err != nil {
		log.Fatal("arith error:", err)
	}
	fmt.Printf("Arith: %d*%d=%d\n", args.A, args.B, reply)
}
Sign in to reply to this message.

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