-
Notifications
You must be signed in to change notification settings - Fork 4
/
disp_serv.go
57 lines (48 loc) · 1.1 KB
/
disp_serv.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
55
56
57
package main
import (
"flag"
"sgame/servers/disp_serv/lib"
"fmt"
)
var config lib.Config
var pconfig *lib.Config = &config
//option
var name_space = flag.String("N", "", "name space in proc_bridge sys")
var proc_id = flag.Int("p", 0, "proc id in proc_bridge sys")
var config_file = flag.String("f", "", "config file")
var proc_name = flag.String("P", "", "proc name ")
var daemonize = flag.Bool("D" , false , "run in daemonize mode")
func init() {
}
func parse_flag() bool {
//check flag
flag.Parse()
if len(*name_space) <= 0 || *proc_id <= 0 || len(*config_file) <= 0 || len(*proc_name) <= 0 {
flag.PrintDefaults()
return false
}
pconfig.ProcId = *proc_id
pconfig.NameSpace = *name_space
pconfig.ConfigFile = *config_file
pconfig.ProcName = *proc_name
pconfig.Daemon = *daemonize
return true
}
func main() {
//parse flag
if parse_flag() == false {
return
}
//comm set
if lib.CommSet(pconfig) == false {
fmt.Printf("comm set failed!\n")
return
}
//self set
if lib.LocalSet(pconfig) == false {
fmt.Printf("self set failed!\n")
return
}
//start server
lib.ServerStart(pconfig)
}