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

Side by Side Diff: client/logdog/butlerlib/streamclient/client_namedPipe_posix.go

Issue 1429993002: LogDog: Add Butler stream server package. (Closed) Base URL: https://github.com/luci/luci-go@logdog-review-butlerproto
Patch Set: Bind POSIX test to POSIX domains. 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // +build darwin dragonfly freebsd linux netbsd openbsd
6
7 package streamclient
8
9 import (
10 "fmt"
11 "io"
12 "net"
13 "os"
14 )
15
16 // Register POSIX-only protocols.
17 func init() {
18 registerProtocol("unix", newUnixSocketClient)
19 }
20
21 // newUnixSocketClient creates a new Client instance bound to a named pipe strea m
22 // server.
23 //
24 // newNPipeClient currently only works on POSIX (non-Windows) systems.
25 func newUnixSocketClient(path string) (Client, error) {
26 // Ensure that the supplied path exists and is a named pipe.
27 info, err := os.Lstat(path)
28 if err != nil {
29 return nil, fmt.Errorf("failed to stat file [%s]: %s", path, err )
30 }
31 if info.Mode()&os.ModeSocket == 0 {
32 return nil, fmt.Errorf("not a named pipe: [%s]", path)
33 }
34
35 return &clientImpl{func() (io.WriteCloser, error) {
36 return net.Dial("unix", path)
37 }}, nil
38 }
OLDNEW
« no previous file with comments | « client/logdog/butlerlib/streamclient/client.go ('k') | client/logdog/butlerlib/streamclient/client_namedPipe_windows.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698