()
| 15 | ) |
| 16 | |
| 17 | func do_server() int { |
| 18 | g_config.read() |
| 19 | if g_config.ForceDebugOutput != "" { |
| 20 | // forcefully enable debugging and redirect logging into the |
| 21 | // specified file |
| 22 | *g_debug = true |
| 23 | f, err := os.Create(g_config.ForceDebugOutput) |
| 24 | if err != nil { |
| 25 | panic(err) |
| 26 | } |
| 27 | log.SetOutput(f) |
| 28 | } |
| 29 | |
| 30 | addr := *g_addr |
| 31 | if *g_sock == "unix" { |
| 32 | addr = get_socket_filename() |
| 33 | if file_exists(addr) { |
| 34 | log.Printf("unix socket: '%s' already exists\n", addr) |
| 35 | return 1 |
| 36 | } |
| 37 | } |
| 38 | g_daemon = new_daemon(*g_sock, addr) |
| 39 | if *g_sock == "unix" { |
| 40 | // cleanup unix socket file |
| 41 | defer os.Remove(addr) |
| 42 | } |
| 43 | |
| 44 | rpc.Register(new(RPC)) |
| 45 | |
| 46 | g_daemon.loop() |
| 47 | return 0 |
| 48 | } |
| 49 | |
| 50 | //------------------------------------------------------------------------- |
| 51 | // daemon |
no test coverage detected