# HG changeset patch # User Chris Jones # Date 1325523701 25200 # Node ID 08d2b9deb710a973ac11fee77606ae67373dd5ff # Parent 8e140810be0221b4bf0013c8651a93b44d1424c4 Simplified the roster filter. diff -r 8e140810be02 -r 08d2b9deb710 roster.go --- a/roster.go Mon Jan 02 09:58:44 2012 -0700 +++ b/roster.go Mon Jan 02 10:01:41 2012 -0700 @@ -78,25 +78,11 @@ func (cl *Client) startRosterFilter() { out := make(chan Stanza) in := cl.AddFilter(out) - go func(inSave <-chan Stanza, outSave chan<- Stanza) { + go func(in <-chan Stanza, out chan<- Stanza) { defer close(out) - in := inSave - var out chan<- Stanza - var st Stanza - var ok bool - for { - select { - case st, ok = <- in: - if !ok { - break - } - cl.maybeUpdateRoster(st) - in = nil - out = outSave - case out <- st: - out = nil - in = inSave - } + for st := range(in) { + cl.maybeUpdateRoster(st) + out <- st } }(in, out) }