Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit fb74847

Browse files
committed
Update spdy Pipe return argument ordering
Every other method which returns a pipe always returns the inbound side as the first return argument (see libchan.Pipe, io.Pipe). Now spdy.Pipe will follow the same convention. fixes #74 Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
1 parent d5db941 commit fb74847

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

spdy/pipe.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type pipeReceiver struct {
1717
}
1818

1919
// Pipe creates a top-level channel pipe using an in memory transport.
20-
func Pipe() (libchan.Sender, libchan.Receiver, error) {
20+
func Pipe() (libchan.Receiver, libchan.Sender, error) {
2121
c1, c2 := net.Pipe()
2222

2323
s1, err := newSession(c1, false)
@@ -52,7 +52,7 @@ func Pipe() (libchan.Sender, libchan.Receiver, error) {
5252
c2.Close()
5353
return nil, nil, receiveErr
5454
}
55-
return &pipeSender{s1, sender}, &pipeReceiver{s2, receiver}, nil
55+
return &pipeReceiver{s2, receiver}, &pipeSender{s1, sender}, nil
5656
}
5757

5858
func (p *pipeSender) Send(message interface{}) error {

spdy/pipe_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func SpawnPipeTest(t *testing.T, client PipeSenderRoutine, server PipeReceiverRo
107107
endClient := make(chan bool)
108108
endServer := make(chan bool)
109109

110-
sender, receiver, err := Pipe()
110+
receiver, sender, err := Pipe()
111111
if err != nil {
112112
t.Fatalf("Error creating pipe: %s", err)
113113
}

spdy/proxy_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ func SpawnProxyTest(t *testing.T, client PipeSenderRoutine, server PipeReceiverR
136136
endServer := make(chan bool)
137137
endProxy := make(chan bool)
138138

139-
sender1, receiver1, err := Pipe()
140-
sender2, receiver2, err := Pipe()
139+
receiver1, sender1, err := Pipe()
140+
receiver2, sender2, err := Pipe()
141141

142142
if err != nil {
143143
t.Fatalf("Error creating pipe: %s", err)

0 commit comments

Comments
 (0)