Chromium Code Reviews| Index: client/internal/logdog/butler/streamserver/npipe_windows.go |
| diff --git a/client/internal/logdog/butler/streamserver/npipe_windows.go b/client/internal/logdog/butler/streamserver/npipe_windows.go |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..135fbd27ba816672147b0a4a0ceb961aeff339a3 |
| --- /dev/null |
| +++ b/client/internal/logdog/butler/streamserver/npipe_windows.go |
| @@ -0,0 +1,47 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +package streamserver |
| + |
| +import ( |
| + "fmt" |
| + "net" |
| + |
| + log "github.com/luci/luci-go/common/logging" |
| + "golang.org/x/net/context" |
| + "gopkg.in/natefinch/npipe.v2" |
| +) |
| + |
| +type namedPipeServer struct { |
| + namedPipeServerBase |
| + |
| + address string // The address of the Windows socket to create |
| +} |
| + |
| +// NewNamedPipeServer instantiates a new POSIX named pipe server instance. |
|
iannucci
2015/11/12 22:44:24
POSIX?
dnj
2015/11/13 20:17:15
Done.
|
| +func NewNamedPipeServer(ctx context.Context, address string) StreamServer { |
| + s := &namedPipeServer{ |
| + address: address, |
| + } |
| + ctx = log.SetField(ctx, "address", address) |
| + s.initBase(ctx) |
| + return s |
| +} |
| + |
| +func (s *namedPipeServer) String() string { |
| + return fmt.Sprintf("NamedPipeServer[%s]", s.address) |
|
iannucci
2015/11/12 22:44:24
we should distinguish these String()'s by somethin
dnj
2015/11/13 20:17:15
This was before logging, so I remove this altogeth
|
| +} |
| + |
| +// Wrapper around the "unix"-type Listener that cleans up the named pipe on |
| +// creation and 'Close()' |
| +type selfCleaningUNIXListener struct { |
| + path string |
| + listener net.Listener |
| +} |
| + |
| +// OS-specific override to create a UNIX named socket listener |
| +func (s *namedPipeServer) createListener() (net.Listener, error) { |
| + log.Debugf(s.ctx, "Creating Windows server socket Listener.") |
| + return npipe.Listen(s.address) |
| +} |