1
0
Fork 0
mirror of https://github.com/eosswedenorg/antelope-api-healthcheck synced 2026-06-18 05:00:03 +02:00

src/main.go: switch go routine/main thread order. run spawnTcpServer() in go routine and run event loop in main thread.

This commit is contained in:
Henrik Hautakoski 2022-08-21 13:46:45 +02:00
parent 6907b3ce75
commit d4cb1a92f9
No known key found for this signature in database
GPG key ID: 608414D93E862CCD
2 changed files with 6 additions and 6 deletions

View file

@ -80,8 +80,8 @@ func signalEventLoop() {
// subscribe to SIGHUP signal.
signal.Notify(sig_ch, syscall.SIGHUP)
// Event loop (runs in a seperate thread)
go func() {
// Event loop
func() {
for {
// Block until we get a signal.
sig := <- sig_ch
@ -149,11 +149,11 @@ func main() {
}
}
// Run the signal event loop.
signalEventLoop()
addr = argv_listen_addr()
// Start listening to TCP Connections
spawnTcpServer(addr);
// Run the signal event loop.
signalEventLoop()
}

View file

@ -52,5 +52,5 @@ func spawnTcpServer(addr string) {
}
logger.Info("TCP Server started", "addr", addr)
server.Listen()
go server.Listen()
}