File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -235,6 +235,7 @@ func main() {
235235 }
236236 if n .admin != nil {
237237 n .admin .SetupAdminHandlers ()
238+ n .admin .Created .Add (1 )
238239 }
239240 }
240241
@@ -284,9 +285,10 @@ func main() {
284285 // Change user if requested
285286 if * chuserto != "" {
286287 // Wait for other goroutines to finish potentially privileged tasks before dropping privileges.
287- doWait := n .admin != nil
288- // control socket: UNIX requires filesystem permissions, TCP may use a low privileged port.
289- for ; doWait ; doWait = ! n .admin .Created {}
288+ if n .admin != nil {
289+ // control socket: UNIX requires filesystem permissions, TCP may use a low privileged port.
290+ n .admin .Created .Wait ()
291+ }
290292
291293 err = chuser (* chuserto )
292294 if err != nil {
Original file line number Diff line number Diff line change 88 "net/url"
99 "os"
1010 "sort"
11-
1211 "strings"
12+ "sync"
1313 "time"
1414
1515 "github.com/yggdrasil-network/yggdrasil-go/src/core"
@@ -26,7 +26,7 @@ type AdminSocket struct {
2626 config struct {
2727 listenaddr ListenAddress
2828 }
29- Created bool
29+ Created sync. WaitGroup
3030}
3131
3232type AdminSocketRequest struct {
@@ -275,7 +275,7 @@ func (a *AdminSocket) listen() {
275275 a .log .Errorf ("Admin socket failed to listen: %v" , err )
276276 os .Exit (1 )
277277 }
278- a .Created = true
278+ a .Created . Done ()
279279 a .log .Infof ("%s admin socket listening on %s" ,
280280 strings .ToUpper (a .listener .Addr ().Network ()),
281281 a .listener .Addr ().String ())
You can’t perform that action at this time.
0 commit comments