| 175 | } |
| 176 | |
| 177 | func (h *Hub) testHubLoop(t *testing.T, results map[string][]*ServerComMessage, done chan bool) { |
| 178 | t.Helper() |
| 179 | for msg := range h.routeSrv { |
| 180 | if msg.RcptTo == "" { |
| 181 | // Don't call t.Fatal from goroutine - instead send error info back |
| 182 | results["__ERROR__"] = []*ServerComMessage{{ |
| 183 | Ctrl: &MsgServerCtrl{ |
| 184 | Code: 500, |
| 185 | Text: "Hub.route received a message without addressee.", |
| 186 | }, |
| 187 | }} |
| 188 | done <- true |
| 189 | return |
| 190 | } |
| 191 | results[msg.RcptTo] = append(results[msg.RcptTo], msg) |
| 192 | } |
| 193 | done <- true |
| 194 | } |
| 195 | |
| 196 | func TestHandleBroadcastDataP2P(t *testing.T) { |
| 197 | numUsers := 2 |