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:
parent
6907b3ce75
commit
d4cb1a92f9
2 changed files with 6 additions and 6 deletions
10
src/main.go
10
src/main.go
|
|
@ -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()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,5 +52,5 @@ func spawnTcpServer(addr string) {
|
|||
}
|
||||
|
||||
logger.Info("TCP Server started", "addr", addr)
|
||||
server.Listen()
|
||||
go server.Listen()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue