Push 将IP加入到处理队列
(ip string)
| 54 | |
| 55 | // Push 将IP加入到处理队列 |
| 56 | func (this *Queue) Push(ip string) { |
| 57 | // 是否在处理中 |
| 58 | if this.cacheMap.Contains(ip) { |
| 59 | return |
| 60 | } |
| 61 | this.cacheMap.Add(ip) |
| 62 | |
| 63 | // 加入到队列 |
| 64 | select { |
| 65 | case this.c <- ip: |
| 66 | default: |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | // Process 处理IP |
| 71 | func (this *Queue) Process(ip string) error { |