veyron/examples/rockpaperscissors: Change Challenge return value.

Change the Player interface's Challenge method to only return an error
value. If the challenge is accepted, it returns nil. Otherwise, it
returns an error describing the reason why it was rejected.

Change-Id: Ifc2abf3003befc1d84e6b38c8c6d256ad29a48bc
diff --git a/examples/rockpaperscissors/impl/impl.go b/examples/rockpaperscissors/impl/impl.go
index 260e9ca..602fe07 100644
--- a/examples/rockpaperscissors/impl/impl.go
+++ b/examples/rockpaperscissors/impl/impl.go
@@ -51,7 +51,7 @@
 	return r.judge.play(names[0], id, stream)
 }
 
-func (r *RPS) Challenge(ctx ipc.Context, address string, id rps.GameID) (bool, error) {
+func (r *RPS) Challenge(ctx ipc.Context, address string, id rps.GameID) error {
 	vlog.VI(1).Infof("Challenge (%q, %+v) from %s", address, id, ctx.RemoteID())
 	return r.player.challenge(address, id)
 }
diff --git a/examples/rockpaperscissors/impl/player.go b/examples/rockpaperscissors/impl/player.go
index 7181304..e423491 100644
--- a/examples/rockpaperscissors/impl/player.go
+++ b/examples/rockpaperscissors/impl/player.go
@@ -1,7 +1,6 @@
 package impl
 
 import (
-	"errors"
 	"io"
 	"math/rand"
 	"sync"
@@ -51,14 +50,10 @@
 		return err
 	}
 	vlog.Infof("chosen opponent is %q", opponent)
-	accepted, err := p.sendChallenge(opponent, judge, gameID)
-	if err != nil {
+	if err = p.sendChallenge(opponent, judge, gameID); err != nil {
 		vlog.Infof("sendChallenge: %v", err)
 		return err
 	}
-	if !accepted {
-		return errors.New("challenge declined")
-	}
 	result, err := p.playGame(judge, gameID)
 	if err != nil {
 		vlog.Infof("playGame: %v", err)
@@ -85,19 +80,19 @@
 	return j.CreateGame(rps.GameOptions{NumRounds: int32(numRounds), GameType: gameType})
 }
 
-func (p *Player) sendChallenge(opponent, judge string, gameID rps.GameID) (bool, error) {
+func (p *Player) sendChallenge(opponent, judge string, gameID rps.GameID) error {
 	o, err := rps.BindRockPaperScissors(opponent)
 	if err != nil {
-		return false, err
+		return err
 	}
 	return o.Challenge(judge, gameID)
 }
 
 // challenge receives an incoming challenge.
-func (p *Player) challenge(judge string, gameID rps.GameID) (bool, error) {
+func (p *Player) challenge(judge string, gameID rps.GameID) error {
 	vlog.Infof("challenge received: %s %v", judge, gameID)
 	go p.playGame(judge, gameID)
-	return true, nil
+	return nil
 }
 
 // playGame plays an entire game, which really only consists of reading
diff --git a/examples/rockpaperscissors/service.vdl b/examples/rockpaperscissors/service.vdl
index 91a8347..4af66e9 100644
--- a/examples/rockpaperscissors/service.vdl
+++ b/examples/rockpaperscissors/service.vdl
@@ -81,8 +81,8 @@
 // Player can receive challenges from other players.
 type Player interface {
   // Challenge is used by other players to challenge this player to a game. If
-  // the challenge is accepted, the method returns true.
-  Challenge(Address string, ID GameID) (bool, error)
+  // the challenge is accepted, the method returns nil.
+  Challenge(Address string, ID GameID) error
 }
 
 // ScoreKeeper receives the outcome of games from Judges.
diff --git a/examples/rockpaperscissors/service.vdl.go b/examples/rockpaperscissors/service.vdl.go
index cdf2198..11b55c5 100644
--- a/examples/rockpaperscissors/service.vdl.go
+++ b/examples/rockpaperscissors/service.vdl.go
@@ -415,8 +415,8 @@
 // to enable embedding without method collisions.  Not to be used directly by clients.
 type Player_ExcludingUniversal interface {
 	// Challenge is used by other players to challenge this player to a game. If
-	// the challenge is accepted, the method returns true.
-	Challenge(Address string, ID GameID, opts ..._gen_ipc.ClientCallOpt) (reply bool, err error)
+	// the challenge is accepted, the method returns nil.
+	Challenge(Address string, ID GameID, opts ..._gen_ipc.ClientCallOpt) (err error)
 }
 type Player interface {
 	_gen_ipc.UniversalServiceMethods
@@ -427,8 +427,8 @@
 type PlayerService interface {
 
 	// Challenge is used by other players to challenge this player to a game. If
-	// the challenge is accepted, the method returns true.
-	Challenge(context _gen_ipc.Context, Address string, ID GameID) (reply bool, err error)
+	// the challenge is accepted, the method returns nil.
+	Challenge(context _gen_ipc.Context, Address string, ID GameID) (err error)
 }
 
 // BindPlayer returns the client stub implementing the Player
@@ -474,12 +474,12 @@
 	name   string
 }
 
-func (__gen_c *clientStubPlayer) Challenge(Address string, ID GameID, opts ..._gen_ipc.ClientCallOpt) (reply bool, err error) {
+func (__gen_c *clientStubPlayer) Challenge(Address string, ID GameID, opts ..._gen_ipc.ClientCallOpt) (err error) {
 	var call _gen_ipc.ClientCall
 	if call, err = __gen_c.client.StartCall(__gen_c.name, "Challenge", []interface{}{Address, ID}, opts...); err != nil {
 		return
 	}
-	if ierr := call.Finish(&reply, &err); ierr != nil {
+	if ierr := call.Finish(&err); ierr != nil {
 		err = ierr
 	}
 	return
@@ -545,7 +545,6 @@
 			{Name: "ID", Type: 65},
 		},
 		OutArgs: []_gen_ipc.MethodArgument{
-			{Name: "", Type: 2},
 			{Name: "", Type: 66},
 		},
 	}
@@ -579,8 +578,8 @@
 	return
 }
 
-func (__gen_s *ServerStubPlayer) Challenge(call _gen_ipc.ServerCall, Address string, ID GameID) (reply bool, err error) {
-	reply, err = __gen_s.service.Challenge(call, Address, ID)
+func (__gen_s *ServerStubPlayer) Challenge(call _gen_ipc.ServerCall, Address string, ID GameID) (err error) {
+	err = __gen_s.service.Challenge(call, Address, ID)
 	return
 }