The documentation for

https://golang.org/pkg/sync/#WaitGroup.Add

suggests you should move the wg.Add(1) out of the Goroutine from here:

https://github.com/Vivena/babelweb2/blob/03d03818e125f6f34c3b323b6cba786075888c00/main.go#L63

to there

https://github.com/Vivena/babelweb2/blob/03d03818e125f6f34c3b323b6cba786075888c00/main.go#L123

so you don't run into trouble with the add not happening in time (if I read
the documentation correctly)

Some haphazard comments:

* Do you happen to know about the context package? It seems like a lot of
the closedown can happen if you recast part of the system as contexts and
cancel those explicitly. It is a fairly recent addition to the standard
library, but it tends to solve a lot of management problems with goroutines.
* probably easier to just to `defer wg.Done()` in ws.MCUpdates.
* MCUpdates should get the above wg.Add(1) treatment as well.
* Idea: is it possible to construct a variant of the code where MCUpdates
isn't even there. It looks as if it reads from a channel and fan-outs to a
multicast group. But why isn't each connectionNode just running the fanout
itself?

This is what I found from a quick skim, that stood a bit out to me.

On Sun, Jul 30, 2017 at 9:35 PM Tyler Compton <xavi...@gmail.com> wrote:

> Hi Juliusz,
>
> How did your students adjust to working with the GOPATH? I'm always
> interested to see how newcomers react to it. It seems to cause some people
> trouble.
>
> On Sun, Jul 30, 2017, 12:14 PM Juliusz Chroboczek <j...@irif.fr> wrote:
>
>> > I glanced at babelweb2 (https://github.com/Vivena/babelweb2/). A code
>> > review would be useful. For example, from parser/parser.go:
>>
>> Thanks for the review.  As I've mentioned, neither the students nor me
>> had any significant experience with Go, so we were learning as we went
>> along.
>>
>> If you happen to have another idle moment, a review of the channel
>> structure will be welcome.
>>
>> Thanks again,
>>
>> -- Juliusz
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to golang-nuts+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to