(q *query.Query, it *iterator.Iterator)
| 119 | } |
| 120 | |
| 121 | func (s *StorageInterface) processQuery(q *query.Query, it *iterator.Iterator) { |
| 122 | var matches bool |
| 123 | pid, scope, _, ok := parseDBKey(q.DatabaseKeyPrefix()) |
| 124 | if !ok { |
| 125 | it.Finish(nil) |
| 126 | return |
| 127 | } |
| 128 | |
| 129 | if pid == "" { |
| 130 | // processes |
| 131 | for _, proc := range process.All() { |
| 132 | func() { |
| 133 | proc.Lock() |
| 134 | defer proc.Unlock() |
| 135 | matches = q.Matches(proc) |
| 136 | }() |
| 137 | if matches { |
| 138 | it.Next <- proc |
| 139 | } |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | if scope == dbScopeNone || scope == dbScopeDNS { |
| 144 | // dns scopes only |
| 145 | for _, dnsConn := range dnsConns.clone() { |
| 146 | if !dnsConn.DataIsComplete() { |
| 147 | continue |
| 148 | } |
| 149 | |
| 150 | func() { |
| 151 | dnsConn.Lock() |
| 152 | defer dnsConn.Unlock() |
| 153 | matches = q.Matches(dnsConn) |
| 154 | }() |
| 155 | |
| 156 | if matches { |
| 157 | it.Next <- dnsConn |
| 158 | } |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | if scope == dbScopeNone || scope == dbScopeIP { |
| 163 | // connections |
| 164 | for _, conn := range conns.clone() { |
| 165 | if !conn.DataIsComplete() { |
| 166 | continue |
| 167 | } |
| 168 | |
| 169 | func() { |
| 170 | conn.Lock() |
| 171 | defer conn.Unlock() |
| 172 | matches = q.Matches(conn) |
| 173 | }() |
| 174 | |
| 175 | if matches { |
| 176 | it.Next <- conn |
| 177 | } |
| 178 | } |
no test coverage detected