-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into transport-comment
- Loading branch information
Showing
48 changed files
with
336 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright (C) 2022 Storj Labs, Inc. | ||
// See LICENSE for copying information. | ||
|
||
package drpcserver | ||
|
||
import ( | ||
"context" | ||
"net" | ||
"testing" | ||
|
||
"github.com/zeebo/assert" | ||
|
||
"storj.io/drpc/drpcctx" | ||
) | ||
|
||
func TestServerTemporarySleep(t *testing.T) { | ||
ctx := drpcctx.NewTracker(context.Background()) | ||
defer ctx.Wait() | ||
defer ctx.Cancel() | ||
|
||
calls := 0 | ||
l := listener(func() (net.Conn, error) { | ||
calls++ | ||
switch calls { | ||
case 1: | ||
case 2: | ||
ctx.Cancel() | ||
default: | ||
panic("spinning on temporary error") | ||
} | ||
|
||
return nil, new(temporaryError) | ||
}) | ||
|
||
assert.NoError(t, New(nil).Serve(ctx, l)) | ||
} | ||
|
||
type listener func() (net.Conn, error) | ||
|
||
func (l listener) Accept() (net.Conn, error) { return l() } | ||
func (l listener) Close() error { return nil } | ||
func (l listener) Addr() net.Addr { return nil } | ||
|
||
type temporaryError struct{} | ||
|
||
func (temporaryError) Error() string { return "temporary error" } | ||
func (temporaryError) Timeout() bool { return false } | ||
func (temporaryError) Temporary() bool { return true } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
module storj.io/drpc/examples/drpc | ||
|
||
go 1.16 | ||
go 1.17 | ||
|
||
require ( | ||
google.golang.org/protobuf v1.26.0 | ||
google.golang.org/protobuf v1.27.1 | ||
storj.io/drpc v0.0.17 | ||
) | ||
|
||
require github.com/zeebo/errs v1.2.2 // indirect | ||
|
||
replace storj.io/drpc => ../.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
module storj.io/drpc/examples/drpc_and_http | ||
|
||
go 1.16 | ||
go 1.17 | ||
|
||
require ( | ||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c | ||
google.golang.org/protobuf v1.26.0 | ||
google.golang.org/protobuf v1.27.1 | ||
storj.io/drpc v0.0.17 | ||
) | ||
|
||
require github.com/zeebo/errs v1.2.2 // indirect | ||
|
||
replace storj.io/drpc => ../.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
module storj.io/drpc/examples/grpc | ||
|
||
go 1.16 | ||
go 1.17 | ||
|
||
require ( | ||
google.golang.org/grpc v1.36.0 | ||
google.golang.org/protobuf v1.26.0 | ||
) | ||
|
||
require ( | ||
github.com/golang/protobuf v1.5.0 // indirect | ||
golang.org/x/net v0.0.0-20190311183353-d8887717615a // indirect | ||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a // indirect | ||
golang.org/x/text v0.3.0 // indirect | ||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect | ||
) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,21 @@ | ||
module storj.io/drpc/examples/grpc_and_drpc | ||
|
||
go 1.16 | ||
go 1.17 | ||
|
||
require ( | ||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c | ||
google.golang.org/grpc v1.36.0 | ||
google.golang.org/protobuf v1.26.0 | ||
google.golang.org/protobuf v1.27.1 | ||
storj.io/drpc v0.0.17 | ||
) | ||
|
||
require ( | ||
github.com/golang/protobuf v1.5.0 // indirect | ||
github.com/zeebo/errs v1.2.2 // indirect | ||
golang.org/x/net v0.0.0-20190311183353-d8887717615a // indirect | ||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a // indirect | ||
golang.org/x/text v0.3.0 // indirect | ||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect | ||
) | ||
|
||
replace storj.io/drpc => ../.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.