Add a comment to indicate why we're waiting on the channel

This commit is contained in:
Chris Bednarski 2015-10-12 18:42:17 -07:00
parent b51cd5406a
commit 4856544027
1 changed files with 2 additions and 1 deletions

View File

@ -140,7 +140,6 @@ func (c *communicator) Download(path string, w io.Writer) (err error) {
streamId := c.mux.NextId() streamId := c.mux.NextId()
waitServer := make(chan bool) waitServer := make(chan bool)
go func() { go func() {
serveSingleCopy("downloadWriter", c.mux, streamId, w, nil) serveSingleCopy("downloadWriter", c.mux, streamId, w, nil)
waitServer <- true waitServer <- true
@ -151,8 +150,10 @@ func (c *communicator) Download(path string, w io.Writer) (err error) {
WriterStreamId: streamId, WriterStreamId: streamId,
} }
// Start sending data to the RPC server
err = c.client.Call("Communicator.Download", &args, new(interface{})) err = c.client.Call("Communicator.Download", &args, new(interface{}))
// Wait for the RPC server to finish receiving the data before we return
<-waitServer <-waitServer
return return