forked from cerc-io/plugeth
Merge tag 'v1.10.17' into merge/v1.10.17
This commit is contained in:
+2
-2
@@ -186,7 +186,7 @@ func DialContext(ctx context.Context, rawurl string) (*Client, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// Client retrieves the client from the context, if any. This can be used to perform
|
||||
// ClientFromContext retrieves the client from the context, if any. This can be used to perform
|
||||
// 'reverse calls' in a handler method.
|
||||
func ClientFromContext(ctx context.Context) (*Client, bool) {
|
||||
client, ok := ctx.Value(clientContextKey{}).(*Client)
|
||||
@@ -333,7 +333,7 @@ func (c *Client) BatchCall(b []BatchElem) error {
|
||||
return c.BatchCallContext(ctx, b)
|
||||
}
|
||||
|
||||
// BatchCall sends all given requests as a single batch and waits for the server
|
||||
// BatchCallContext sends all given requests as a single batch and waits for the server
|
||||
// to return a response for all of them. The wait duration is bounded by the
|
||||
// context's deadline.
|
||||
//
|
||||
|
||||
@@ -26,6 +26,7 @@ import (
|
||||
)
|
||||
|
||||
const MetadataApi = "rpc"
|
||||
const EngineApi = "engine"
|
||||
|
||||
// CodecOption specifies which type of messages a codec supports.
|
||||
//
|
||||
|
||||
+3
-1
@@ -134,7 +134,7 @@ func TestServerShortLivedConn(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal("can't dial:", err)
|
||||
}
|
||||
defer conn.Close()
|
||||
|
||||
conn.SetDeadline(deadline)
|
||||
// Write the request, then half-close the connection so the server stops reading.
|
||||
conn.Write([]byte(request))
|
||||
@@ -142,6 +142,8 @@ func TestServerShortLivedConn(t *testing.T) {
|
||||
// Now try to get the response.
|
||||
buf := make([]byte, 2000)
|
||||
n, err := conn.Read(buf)
|
||||
conn.Close()
|
||||
|
||||
if err != nil {
|
||||
t.Fatal("read error:", err)
|
||||
}
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ import (
|
||||
var (
|
||||
// ErrNotificationsUnsupported is returned when the connection doesn't support notifications
|
||||
ErrNotificationsUnsupported = errors.New("notifications not supported")
|
||||
// ErrNotificationNotFound is returned when the notification for the given id is not found
|
||||
// ErrSubscriptionNotFound is returned when the notification for the given id is not found
|
||||
ErrSubscriptionNotFound = errors.New("subscription not found")
|
||||
)
|
||||
|
||||
|
||||
+5
-4
@@ -30,10 +30,11 @@ import (
|
||||
|
||||
// API describes the set of methods offered over the RPC interface
|
||||
type API struct {
|
||||
Namespace string // namespace under which the rpc methods of Service are exposed
|
||||
Version string // api version for DApp's
|
||||
Service interface{} // receiver instance which holds the methods
|
||||
Public bool // indication if the methods must be considered safe for public use
|
||||
Namespace string // namespace under which the rpc methods of Service are exposed
|
||||
Version string // api version for DApp's
|
||||
Service interface{} // receiver instance which holds the methods
|
||||
Public bool // indication if the methods must be considered safe for public use
|
||||
Authenticated bool // whether the api should only be available behind authentication.
|
||||
}
|
||||
|
||||
// ServerCodec implements reading, parsing and writing RPC messages for the server side of
|
||||
|
||||
@@ -76,7 +76,7 @@ func TestWebsocketOriginCheck(t *testing.T) {
|
||||
// Connections without origin header should work.
|
||||
client, err = DialWebsocket(context.Background(), wsURL, "")
|
||||
if err != nil {
|
||||
t.Fatal("error for empty origin")
|
||||
t.Fatalf("error for empty origin: %v", err)
|
||||
}
|
||||
client.Close()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user