Skip to content

Commit ce1bc63

Browse files
authored
Remove unused code and usages of deprecated functions. (#97)
1 parent 9fc29ee commit ce1bc63

File tree

8 files changed

+12
-66
lines changed

8 files changed

+12
-66
lines changed

client/proxy.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func createTransport(tlsClientConf *tls.Config, forceHTTP2 bool, extraH2ALPNs []
115115
TLSClientConfig: tlsClientConf,
116116
}
117117
if tlsClientConf == nil {
118-
transport.DialTLS = func(network, addr string, _ *tls.Config) (net.Conn, error) {
118+
transport.DialTLSContext = func(_ context.Context, network, addr string, _ *tls.Config) (net.Conn, error) {
119119
return net.Dial(network, addr)
120120
}
121121
}
@@ -151,7 +151,7 @@ func createClientProxy(endpoint string, tlsClientConf *tls.Config, forceHTTP2, f
151151
return makeProxyServer(proxy)
152152
}
153153

154-
// ConnectViaProxy establishes a gRPC client connection via a HTTP/2 proxy that handles endpoints behind HTTP/1.x proxies.
154+
// ConnectViaProxy establishes a gRPC client connection via an HTTP/2 proxy that handles endpoints behind HTTP/1.x proxies.
155155
// Use the WithWebSocket() ConnectOption if you want to connect to a server via WebSocket.
156156
// Otherwise, setting it to false will use a gRPC-Web "downgrade", as needed.
157157
//

internal/concurrency/do.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,6 @@ import (
1818
"time"
1919
)
2020

21-
// Do performs the action as soon as the waitable is done.
22-
// It blocks indefinitely until that happens.
23-
func Do(w Waitable, action func()) {
24-
Wait(w)
25-
action()
26-
}
27-
2821
// DoWithTimeout performs the action as soon as the waitable is done.
2922
// It gives up and returns after timeout, and returns a bool indicating whether
3023
// the action was performed or not.

internal/concurrency/signal.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ import (
1919
"unsafe"
2020
)
2121

22+
var (
23+
closedCh = func() chan struct{} {
24+
ch := make(chan struct{})
25+
close(ch)
26+
return ch
27+
}()
28+
)
29+
2230
// Signal implements a signalling facility. Unlike sync.Cond, it is based on channels and can hence be used
2331
// in `select` statements.
2432
// There are two ways to instantiate a Signal. The preferred way is by calling `NewSignal()`, which will return a signal

internal/concurrency/util.go

Lines changed: 0 additions & 28 deletions
This file was deleted.

internal/concurrency/wait.go

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@ package concurrency
1616

1717
import "time"
1818

19-
// Never satisfies the Waitable interface, but will never be signaled
20-
// Waiting will block indefinitely
21-
func Never() WaitableChan {
22-
return WaitableChan(nil)
23-
}
24-
2519
// Wait waits indefinitely until the condition represented by the given Waitable is fulfilled.
2620
func Wait(w Waitable) {
2721
<-w.Done()
@@ -55,22 +49,3 @@ func WaitWithTimeout(w Waitable, timeout time.Duration) bool {
5549
return false
5650
}
5751
}
58-
59-
// WaitWithDeadline waits for the given Waitable until a specified deadline. It returns false if the deadline expired
60-
// before the condition was fulfilled, true otherwise.
61-
func WaitWithDeadline(w Waitable, deadline time.Time) bool {
62-
timeout := time.Until(deadline)
63-
return WaitWithTimeout(w, timeout)
64-
}
65-
66-
// WaitInContext waits for the given Waitable until a `parentContext` is done. Note that despite its name,
67-
// `parentContext` can be any waitable, not just a context.
68-
// It returns false if the parentContext is done first, true otherwise.
69-
func WaitInContext(w Waitable, parentContext Waitable) bool {
70-
select {
71-
case <-w.Done():
72-
return true
73-
case <-parentContext.Done():
74-
return false
75-
}
76-
}

internal/size/size.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,4 @@ const (
2121
KB = 1024 * B
2222
// MB = megabyte
2323
MB = 1024 * KB
24-
// GB = gigabyte
25-
GB = 1024 * MB
2624
)

server/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ func handleGRPCWeb(w http.ResponseWriter, req *http.Request, validPaths map[stri
138138
return
139139
}
140140

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

server/websocket_writer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func (w *wsResponseWriter) WriteHeader(statusCode int) {
8686
w.headerWritten = true
8787
}
8888

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

0 commit comments

Comments
 (0)