-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
54 lines (45 loc) · 1.17 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Copyright (c) 2015 Cameron King. All rights reserved.
// License: BSD 2-clause.
// Website: https://github.com/ckxng/wakeup
package main
import (
"os"
"log"
"wakeup/window"
"wakeup/config"
"wakeup/server"
)
var logger *log.Logger = log.New(os.Stdout, "[main] ", log.Lshortfile)
var main_is_running = false
func main() {
cWindow := make(chan int)
cServer := make(chan int)
logger.Println("config.NewConfig")
cfg := config.NewConfig()
cfg.Title = "Wakeup"
// cef2go calls itself several times to start subprocesses of the
// executable. Since we are running a server, only the first executable
// can bind the port.
if len(os.Args) > 1 {
logger.Println("os.Args are present, not running server")
cfg.EnableServer = false
}
if(cfg.EnableServer) {
logger.Println("go server.Go")
go server.Go(cfg, cServer)
}
if(cfg.EnableWindow) {
logger.Println("go window.Go")
go window.Go(cfg, cWindow)
}
for {
select {
case iExitWindow := <- cWindow:
logger.Printf("Window Exit: %d\n", iExitWindow)
os.Exit(iExitWindow)
case iExitServer := <- cServer:
logger.Printf("Server Exit: %d\n", iExitServer)
os.Exit(iExitServer)
}
}
}