Code maintenance: Shadowsocks loop refactor

This commit is contained in:
Quentin McGaw
2020-12-30 22:01:08 +00:00
parent fa7bda7ee4
commit 251555f859
3 changed files with 149 additions and 79 deletions

View File

@@ -266,16 +266,12 @@ func _main(background context.Context, buildInfo models.BuildInformation,
go httpProxyLooper.Run(ctx, wg)
shadowsocksLooper := shadowsocks.NewLooper(allSettings.ShadowSocks, logger)
restartShadowsocks := shadowsocksLooper.Restart
wg.Add(1)
go shadowsocksLooper.Run(ctx, wg)
if allSettings.HTTPProxy.Enabled {
_, _ = httpProxyLooper.SetStatus(constants.Running)
}
if allSettings.ShadowSocks.Enabled {
restartShadowsocks()
}
wg.Add(1)
go routeReadyEvents(ctx, wg, buildInfo, tunnelReadyCh, dnsReadyCh,