Simplified the roster filter.
--- 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)
}