| 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 "errors" | 8 "errors" |
| 9 "fmt" | |
| 10 "os" | 9 "os" |
| 11 | 10 |
| 12 "github.com/luci/luci-go/logdog/client/butler/streamserver" | 11 "github.com/luci/luci-go/logdog/client/butler/streamserver" |
| 13 "golang.org/x/net/context" | 12 "golang.org/x/net/context" |
| 14 ) | 13 ) |
| 15 | 14 |
| 16 const ( | 15 const ( |
| 17 // An example stream server URI. | 16 // An example stream server URI. |
| 18 // | 17 // |
| 19 // This expands to: //localhost/pipe/<name> | 18 // This expands to: //localhost/pipe/<name> |
| (...skipping 20 matching lines...) Expand all Loading... |
| 40 return value, nil | 39 return value, nil |
| 41 } | 40 } |
| 42 | 41 |
| 43 // Validates that the URI is correct for Windows. | 42 // Validates that the URI is correct for Windows. |
| 44 func (u streamServerURI) Validate() error { | 43 func (u streamServerURI) Validate() error { |
| 45 _, err := u.Parse() | 44 _, err := u.Parse() |
| 46 return err | 45 return err |
| 47 } | 46 } |
| 48 | 47 |
| 49 // Create a Windows stream server. | 48 // Create a Windows stream server. |
| 50 func createStreamServer(ctx context.Context, uri streamServerURI) streamserver.S
treamServer { | 49 func createStreamServer(ctx context.Context, uri streamServerURI) (streamserver.
StreamServer, error) { |
| 51 name, err := uri.Parse() | 50 name, err := uri.Parse() |
| 52 if err != nil { | 51 if err != nil { |
| 53 panic("Failed to parse stream server URI.") | 52 panic("Failed to parse stream server URI.") |
| 54 } | 53 } |
| 55 » return streamserver.NewNamedPipeServer(ctx, fmt.Sprintf(`\\.\pipe\%s`, n
ame)) | 54 » return streamserver.NewNamedPipeServer(ctx, name) |
| 56 } | 55 } |
| OLD | NEW |