(contractAddrs map[string]bool, txHashStr string, resp map[string]interface{})
| 390 | } |
| 391 | |
| 392 | func (self *WsServer) PushTxResult(contractAddrs map[string]bool, txHashStr string, resp map[string]interface{}) { |
| 393 | self.Lock() |
| 394 | sessionId := self.TxHashMap[txHashStr] |
| 395 | delete(self.TxHashMap, txHashStr) |
| 396 | //avoid twice, will send in BroadcastToSubscribers |
| 397 | sub := self.SubscribeMap[sessionId] |
| 398 | if sub.SubscribeEvent { |
| 399 | if len(sub.ContractsFilter) == 0 { |
| 400 | self.Unlock() |
| 401 | return |
| 402 | } |
| 403 | for _, addr := range sub.ContractsFilter { |
| 404 | if contractAddrs[addr] { |
| 405 | self.Unlock() |
| 406 | return |
| 407 | } |
| 408 | } |
| 409 | } |
| 410 | self.Unlock() |
| 411 | |
| 412 | s := self.SessionList.GetSessionById(sessionId) |
| 413 | if s != nil { |
| 414 | s.Send(marshalResp(resp)) |
| 415 | } |
| 416 | } |
| 417 | func (self *WsServer) BroadcastToSubscribers(contractAddrs map[string]bool, sub int, resp map[string]interface{}) { |
| 418 | // broadcast SubscribeMap |
| 419 | self.Lock() |
no test coverage detected