Stop stops the exchange service and disconnect from the ethereum network.
()
| 151 | |
| 152 | // Stop stops the exchange service and disconnect from the ethereum network. |
| 153 | func (e *Exchange) Stop() { |
| 154 | e.stopPreviousSubscribe() |
| 155 | |
| 156 | if e.newBlockHeaderCh != nil { |
| 157 | close(e.newBlockHeaderCh) |
| 158 | e.newBlockHeaderCh = nil |
| 159 | } |
| 160 | if e.cancelProcess != nil { |
| 161 | e.cancelProcess() |
| 162 | e.cancelProcess = nil |
| 163 | e.processCtx = nil |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | func (e *Exchange) stopPreviousSubscribe() { |
| 168 | if e.subscription != nil { |
no test coverage detected