emitProxyState method

void emitProxyState(
  1. ProxyState state
)

供 HelperHttpClient 调用,取代直接访问 controller。

连接成功(started)时顺带后台刷新代理模式——clash mode 的数据来源与推送 都内聚在本类,HelperHttpClient 只管 helper service 控制与状态转发。

Implementation

void emitProxyState(ProxyState state) {
  _lastProxyState = state;
  _controller.add(state);
  if (state == ProxyState.started) {
    unawaited(_refreshClashMode());
    _startGroupRefresh();
  } else if (state == ProxyState.stopped) {
    _cancelGroupRefresh();
  }
}