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

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

Issue 2737603003: Butler stream servers can generate client address. (Closed)
Patch Set: better comment Created 3 years, 9 months 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
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 streamclient 5 package streamclient
6 6
7 import ( 7 import (
8 "encoding/json" 8 "encoding/json"
9 "fmt" 9 "fmt"
10 "io" 10 "io"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 client.Close() 63 client.Close()
64 } 64 }
65 }() 65 }()
66 66
67 data, err := json.Marshal(f) 67 data, err := json.Marshal(f)
68 if err != nil { 68 if err != nil {
69 return nil, fmt.Errorf("failed to marshal properties JSON: %s", err) 69 return nil, fmt.Errorf("failed to marshal properties JSON: %s", err)
70 } 70 }
71 71
72 // Perform the handshake: magic + size(data) + data. 72 // Perform the handshake: magic + size(data) + data.
73 » s := &streamImpl{ 73 » s := &BaseStream{
74 WriteCloser: client, 74 WriteCloser: client,
75 » » props: p, 75 » » P: p,
76 } 76 }
77 if _, err := s.writeRaw(streamproto.ProtocolFrameHeaderMagic); err != ni l { 77 if _, err := s.writeRaw(streamproto.ProtocolFrameHeaderMagic); err != ni l {
78 return nil, fmt.Errorf("failed to write magic number: %s", err) 78 return nil, fmt.Errorf("failed to write magic number: %s", err)
79 } 79 }
80 if err := s.writeRecord(data); err != nil { 80 if err := s.writeRecord(data); err != nil {
81 return nil, fmt.Errorf("failed to write properties: %s", err) 81 return nil, fmt.Errorf("failed to write properties: %s", err)
82 } 82 }
83 83
84 ownsClient = false // Passing ownership to caller. 84 ownsClient = false // Passing ownership to caller.
85 return s, nil 85 return s, nil
86 } 86 }
OLDNEW
« no previous file with comments | « logdog/client/butler/streamserver/streamserver.go ('k') | logdog/client/butlerlib/streamclient/client_namedPipe_windows.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698