chat: Remove server.Stop.

Change-Id: Id45325377f80eda23cb6706cd713dcf76548884b
MultiPart: 3/4
diff --git a/clients/shell/go/src/v.io/x/chat/channel.go b/clients/shell/go/src/v.io/x/chat/channel.go
index 5e4fbb6..32058a5 100644
--- a/clients/shell/go/src/v.io/x/chat/channel.go
+++ b/clients/shell/go/src/v.io/x/chat/channel.go
@@ -105,6 +105,7 @@
 	chatServerMethods *chatServerMethods
 	// The chat server.
 	server rpc.Server
+	stop   func()
 	// Channel that emits incoming messages.
 	messages chan message
 	// Cached list of channel members.
@@ -210,7 +211,12 @@
 	serverChat := vdl.ChatServer(cr.chatServerMethods)
 
 	// Create a new server.
-	_, cr.server, err = v23.WithNewServer(cr.ctx, name, serverChat, security.AllowEveryone())
+	ctx, cancel := context.WithCancel(cr.ctx)
+	_, cr.server, err = v23.WithNewServer(ctx, name, serverChat, security.AllowEveryone())
+	cr.stop = func() {
+		cancel()
+		<-cr.server.Closed()
+	}
 	return err
 }
 
@@ -218,7 +224,7 @@
 // mounttable.
 func (cr *channel) leave() error {
 	// Stop serving.
-	cr.server.Stop()
+	cr.stop()
 
 	// Get the names we are mounted at.  Should only be one.
 	names := rpc.PublisherNames(cr.server.Status().PublisherStatus)