Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Unified Diff: client/logdog/butlerlib/streamclient/client_npipe_windows.go

Issue 1429993002: LogDog: Add Butler stream server package. (Closed) Base URL: https://github.com/luci/luci-go@logdog-review-butlerproto
Patch Set: Fixed datagram check, now with unit tests! Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: client/logdog/butlerlib/streamclient/client_npipe_windows.go
diff --git a/client/logdog/butlerlib/streamclient/client_npipe_windows.go b/client/logdog/butlerlib/streamclient/client_npipe_windows.go
new file mode 100644
index 0000000000000000000000000000000000000000..fe92ccb79b8f7c0ad0d3ed16047f1cbfca4a4a93
--- /dev/null
+++ b/client/logdog/butlerlib/streamclient/client_npipe_windows.go
@@ -0,0 +1,30 @@
+// 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 streamclient
+
+import (
+ "errors"
+ "fmt"
+ "io"
+
+ "gopkg.in/natefinch/npipe.v2"
+)
+
+// Register POSIX-only protocols.
+func init() {
+ registerProtocol("net.pipe", newNamedPipeClient)
+}
+
+// newNamedPipeClient creates a new Client instance bound to a named pipe stream
+// server.
+func newNamedPipeClient(path string) (Client, error) {
+ if path == "" {
+ return nil, errors.New("streamclient: cannot have empty named pipe path")
+ }
+
+ return &clientImpl{func() (io.WriteCloser, error) {
+ return npipe.Dial(fmt.Sprintf(`\\.\pipe\%s`, path))
+ }}
+}

Powered by Google App Engine
This is Rietveld 408576698