mirror of
				https://github.com/k3s-io/kubernetes.git
				synced 2025-11-03 23:40:03 +00:00 
			
		
		
		
	godep restore pushd $GOPATH/src/github.com/appc/spec git co master popd go get go4.org/errorutil rm -rf Godeps godep save ./... git add vendor git add -f $(git ls-files --other vendor/) git co -- Godeps/LICENSES Godeps/.license_file_state Godeps/OWNERS
		
			
				
	
	
		
			39 lines
		
	
	
		
			746 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			746 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package spdystream
 | 
						|
 | 
						|
import (
 | 
						|
	"io"
 | 
						|
	"net/http"
 | 
						|
)
 | 
						|
 | 
						|
// MirrorStreamHandler mirrors all streams.
 | 
						|
func MirrorStreamHandler(stream *Stream) {
 | 
						|
	replyErr := stream.SendReply(http.Header{}, false)
 | 
						|
	if replyErr != nil {
 | 
						|
		return
 | 
						|
	}
 | 
						|
 | 
						|
	go func() {
 | 
						|
		io.Copy(stream, stream)
 | 
						|
		stream.Close()
 | 
						|
	}()
 | 
						|
	go func() {
 | 
						|
		for {
 | 
						|
			header, receiveErr := stream.ReceiveHeader()
 | 
						|
			if receiveErr != nil {
 | 
						|
				return
 | 
						|
			}
 | 
						|
			sendErr := stream.SendHeader(header, false)
 | 
						|
			if sendErr != nil {
 | 
						|
				return
 | 
						|
			}
 | 
						|
		}
 | 
						|
	}()
 | 
						|
}
 | 
						|
 | 
						|
// NoopStreamHandler does nothing when stream connects, most
 | 
						|
// likely used with RejectAuthHandler which will not allow any
 | 
						|
// streams to make it to the stream handler.
 | 
						|
func NoOpStreamHandler(stream *Stream) {
 | 
						|
	stream.SendReply(http.Header{}, false)
 | 
						|
}
 |