| OLD | NEW |
| 1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package main | 5 package main |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 log "github.com/luci/luci-go/common/logging" | 8 log "github.com/luci/luci-go/common/logging" |
| 9 "github.com/luci/luci-go/logdog/client/butler" | 9 "github.com/luci/luci-go/logdog/client/butler" |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 func (cmd *serveCommandRun) Run(app subcommands.Application, args []string, _ su
bcommands.Env) int { | 33 func (cmd *serveCommandRun) Run(app subcommands.Application, args []string, _ su
bcommands.Env) int { |
| 34 a := app.(*application) | 34 a := app.(*application) |
| 35 | 35 |
| 36 if err := cmd.uri.Validate(); err != nil { | 36 if err := cmd.uri.Validate(); err != nil { |
| 37 log.Fields{ | 37 log.Fields{ |
| 38 "flag": "-streamserver_uri", | 38 "flag": "-streamserver_uri", |
| 39 "value": cmd.uri, | 39 "value": cmd.uri, |
| 40 }.Errorf(a, "Invalid stream server URI.") | 40 }.Errorf(a, "Invalid stream server URI.") |
| 41 return configErrorReturnCode | 41 return configErrorReturnCode |
| 42 } | 42 } |
| 43 » streamServer := createStreamServer(a, cmd.uri) | 43 » streamServer, err := createStreamServer(a, cmd.uri) |
| 44 » if err != nil { |
| 45 » » log.WithError(err).Errorf(a, "Failed to create stream server.") |
| 46 » » return runtimeErrorReturnCode |
| 47 » } |
| 44 | 48 |
| 45 if err := streamServer.Listen(); err != nil { | 49 if err := streamServer.Listen(); err != nil { |
| 46 log.Errorf(log.SetError(a, err), "Failed to connect to stream se
rver.") | 50 log.Errorf(log.SetError(a, err), "Failed to connect to stream se
rver.") |
| 47 return runtimeErrorReturnCode | 51 return runtimeErrorReturnCode |
| 48 } | 52 } |
| 49 | 53 |
| 50 // We think everything will work. Configure our Output instance. | 54 // We think everything will work. Configure our Output instance. |
| 51 of, err := a.getOutputFactory() | 55 of, err := a.getOutputFactory() |
| 52 if err != nil { | 56 if err != nil { |
| 53 log.WithError(err).Errorf(a, "Failed to get output factory insta
nce.") | 57 log.WithError(err).Errorf(a, "Failed to get output factory insta
nce.") |
| (...skipping 10 matching lines...) Expand all Loading... |
| 64 b.AddStreamServer(streamServer) | 68 b.AddStreamServer(streamServer) |
| 65 return b.Wait() | 69 return b.Wait() |
| 66 }) | 70 }) |
| 67 if err != nil { | 71 if err != nil { |
| 68 logAnnotatedErr(a, err, "Failed to serve.") | 72 logAnnotatedErr(a, err, "Failed to serve.") |
| 69 return runtimeErrorReturnCode | 73 return runtimeErrorReturnCode |
| 70 } | 74 } |
| 71 | 75 |
| 72 return 0 | 76 return 0 |
| 73 } | 77 } |
| OLD | NEW |