@@ -50,27 +50,28 @@ func NewCommand() *cobra.Command {
50
50
}
51
51
52
52
func runDaemonCommand (cmd * cobra.Command , args []string ) {
53
- lis , err := net .Listen ("tcp" , port )
54
- if err != nil {
55
- log .Fatalf ("failed to listen: %v" , err )
56
- }
57
53
s := grpc .NewServer ()
58
54
59
- userAgentValue := fmt .Sprintf ("%s/%s daemon (%s; %s; %s) Commit:%s" , globals .VersionInfo .Application ,
60
- globals .VersionInfo .VersionString , runtime .GOARCH , runtime .GOOS , runtime .Version (), globals .VersionInfo .Commit )
61
- headers := http.Header {"User-Agent" : []string {userAgentValue }}
62
-
63
55
// register the commands service
64
- coreServer := daemon.ArduinoCoreServerImpl {
56
+ headers := http.Header {"User-Agent" : []string {
57
+ fmt .Sprintf ("%s/%s daemon (%s; %s; %s) Commit:%s" ,
58
+ globals .VersionInfo .Application ,
59
+ globals .VersionInfo .VersionString ,
60
+ runtime .GOARCH , runtime .GOOS ,
61
+ runtime .Version (), globals .VersionInfo .Commit )}}
62
+ srv_commands .RegisterArduinoCoreServer (s , & daemon.ArduinoCoreServerImpl {
65
63
DownloaderHeaders : headers ,
66
64
VersionString : globals .VersionInfo .VersionString ,
67
65
Config : globals .Config ,
68
- }
69
- srv_commands .RegisterArduinoCoreServer (s , & coreServer )
66
+ })
70
67
71
68
// register the monitors service
72
69
srv_monitor .RegisterMonitorServer (s , & daemon.MonitorService {})
73
70
71
+ lis , err := net .Listen ("tcp" , port )
72
+ if err != nil {
73
+ log .Fatalf ("failed to listen: %v" , err )
74
+ }
74
75
if err := s .Serve (lis ); err != nil {
75
76
log .Fatalf ("failed to serve: %v" , err )
76
77
}
0 commit comments