roster.go
changeset 50 08d2b9deb710
parent 47 22e575eff35a
child 52 9b664fde0ec3
--- 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)
 }