Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions client/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func createTransport(tlsClientConf *tls.Config, forceHTTP2 bool, extraH2ALPNs []
TLSClientConfig: tlsClientConf,
}
if tlsClientConf == nil {
transport.DialTLS = func(network, addr string, _ *tls.Config) (net.Conn, error) {
transport.DialTLSContext = func(_ context.Context, network, addr string, _ *tls.Config) (net.Conn, error) {
return net.Dial(network, addr)
}
}
Expand Down Expand Up @@ -151,7 +151,7 @@ func createClientProxy(endpoint string, tlsClientConf *tls.Config, forceHTTP2, f
return makeProxyServer(proxy)
}

// ConnectViaProxy establishes a gRPC client connection via a HTTP/2 proxy that handles endpoints behind HTTP/1.x proxies.
// ConnectViaProxy establishes a gRPC client connection via an HTTP/2 proxy that handles endpoints behind HTTP/1.x proxies.
// Use the WithWebSocket() ConnectOption if you want to connect to a server via WebSocket.
// Otherwise, setting it to false will use a gRPC-Web "downgrade", as needed.
//
Expand Down
7 changes: 0 additions & 7 deletions internal/concurrency/do.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@ import (
"time"
)

// Do performs the action as soon as the waitable is done.
// It blocks indefinitely until that happens.
func Do(w Waitable, action func()) {
Wait(w)
action()
}

// DoWithTimeout performs the action as soon as the waitable is done.
// It gives up and returns after timeout, and returns a bool indicating whether
// the action was performed or not.
Expand Down
8 changes: 8 additions & 0 deletions internal/concurrency/signal.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ import (
"unsafe"
)

var (
closedCh = func() chan struct{} {
ch := make(chan struct{})
close(ch)
return ch
}()
)

// Signal implements a signalling facility. Unlike sync.Cond, it is based on channels and can hence be used
// in `select` statements.
// There are two ways to instantiate a Signal. The preferred way is by calling `NewSignal()`, which will return a signal
Expand Down
28 changes: 0 additions & 28 deletions internal/concurrency/util.go

This file was deleted.

25 changes: 0 additions & 25 deletions internal/concurrency/wait.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ package concurrency

import "time"

// Never satisfies the Waitable interface, but will never be signaled
// Waiting will block indefinitely
func Never() WaitableChan {
return WaitableChan(nil)
}

// Wait waits indefinitely until the condition represented by the given Waitable is fulfilled.
func Wait(w Waitable) {
<-w.Done()
Expand Down Expand Up @@ -55,22 +49,3 @@ func WaitWithTimeout(w Waitable, timeout time.Duration) bool {
return false
}
}

// WaitWithDeadline waits for the given Waitable until a specified deadline. It returns false if the deadline expired
// before the condition was fulfilled, true otherwise.
func WaitWithDeadline(w Waitable, deadline time.Time) bool {
timeout := time.Until(deadline)
return WaitWithTimeout(w, timeout)
}

// WaitInContext waits for the given Waitable until a `parentContext` is done. Note that despite its name,
// `parentContext` can be any waitable, not just a context.
// It returns false if the parentContext is done first, true otherwise.
func WaitInContext(w Waitable, parentContext Waitable) bool {
select {
case <-w.Done():
return true
case <-parentContext.Done():
return false
}
}
2 changes: 0 additions & 2 deletions internal/size/size.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,4 @@ const (
KB = 1024 * B
// MB = megabyte
MB = 1024 * KB
// GB = gigabyte
GB = 1024 * MB
)
2 changes: 1 addition & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func handleGRPCWeb(w http.ResponseWriter, req *http.Request, validPaths map[stri
return
}

// Tell the server we would accept trailers (the gRPC server currently (v1.29.1) doesn't check for this but it
// Tell the server we would accept trailers (the gRPC server currently (v1.29.1) doesn't check for this, but it
// really should, as the purpose of the TE header according to the gRPC spec is to detect incompatible proxies).
req.Header.Set("TE", "trailers")

Expand Down
2 changes: 1 addition & 1 deletion server/websocket_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (w *wsResponseWriter) WriteHeader(statusCode int) {
w.headerWritten = true
}

// Flush is a No-Op since the underlying writer is a io.PipeWriter,
// Flush is a No-Op since the underlying writer is an io.PipeWriter,
// which does no internal buffering.
func (w *wsResponseWriter) Flush() {}

Expand Down