aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/client.go
Commit message (Collapse)AuthorAgeFilesLines
* rpc: implement full bi-directional communication (#18471)Felix Lange2019-02-041-361/+187
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | New APIs added: client.RegisterName(namespace, service) // makes service available to server client.Notify(ctx, method, args...) // sends a notification ClientFromContext(ctx) // to get a client in handler method This is essentially a rewrite of the server-side code. JSON-RPC processing code is now the same on both server and client side. Many minor issues were fixed in the process and there is a new test suite for JSON-RPC spec compliance (and non-compliance in some cases). List of behavior changes: - Method handlers are now called with a per-request context instead of a per-connection context. The context is canceled right after the method returns. - Subscription error channels are always closed when the connection ends. There is no need to also wait on the Notifier's Closed channel to detect whether the subscription has ended. - Client now omits "params" instead of sending "params": null when there are no arguments to a call. The previous behavior was not compliant with the spec. The server still accepts "params": null. - Floating point numbers are allowed as "id". The spec doesn't allow them, but we handle request "id" as json.RawMessage and guarantee that the same number will be sent back. - Logging is improved significantly. There is now a message at DEBUG level for each RPC call served.
* rpc: fix client shutdown hang when Close races with Unsubscribe (#17894)Felix Lange2018-10-151-47/+12
| | | Fixes #17837
* rpc: reset client write deadline after write (#17549)Gísli Kristjánsson2018-09-031-0/+1
| | | This fixes an issue with websocket ping frame handling.
* rpc: fixed comment grammar issue (#17146)LeoLiao2018-07-091-1/+1
|
* all: library changes for swarm-network-rewrite (#16898)Elad2018-06-141-1/+1
| | | | | | | | | | | | This commit adds all changes needed for the merge of swarm-network-rewrite. The changes: - build: increase linter timeout - contracts/ens: export ensNode - log: add Output method and enable fractional seconds in format - metrics: relax test timeout - p2p: reduced some log levels, updates to simulation packages - rpc: increased maxClientSubscriptionBuffer to 20000
* rpc: clean up IPC handler (#16524)Felix Lange2018-04-181-1/+1
| | | | This avoids logging accept errors on shutdown and removes a bit of duplication. It also fixes some goimports lint warnings.
* cmd/clef, signer: initial poc of the standalone signer (#16154)Martin Holst Swende2018-04-161-6/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * signer: introduce external signer command * cmd/signer, rpc: Implement new signer. Add info about remote user to Context * signer: refactored request/response, made use of urfave.cli * cmd/signer: Use common flags * cmd/signer: methods to validate calldata against abi * cmd/signer: work on abi parser * signer: add mutex around UI * cmd/signer: add json 4byte directory, remove passwords from api * cmd/signer: minor changes * cmd/signer: Use ErrRequestDenied, enable lightkdf * cmd/signer: implement tests * cmd/signer: made possible for UI to modify tx parameters * cmd/signer: refactors, removed channels in ui comms, added UI-api via stdin/out * cmd/signer: Made lowercase json-definitions, added UI-signer test functionality * cmd/signer: update documentation * cmd/signer: fix bugs, improve abi detection, abi argument display * cmd/signer: minor change in json format * cmd/signer: rework json communication * cmd/signer: implement mixcase addresses in API, fix json id bug * cmd/signer: rename fromaccount, update pythonpoc with new json encoding format * cmd/signer: make use of new abi interface * signer: documentation * signer/main: remove redundant option * signer: implement audit logging * signer: create package 'signer', minor changes * common: add 0x-prefix to mixcaseaddress in json marshalling + validation * signer, rules, storage: implement rules + ephemeral storage for signer rules * signer: implement OnApprovedTx, change signing response (API BREAKAGE) * signer: refactoring + documentation * signer/rules: implement dispatching to next handler * signer: docs * signer/rules: hide json-conversion from users, ensure context is cleaned * signer: docs * signer: implement validation rules, change signature of call_info * signer: fix log flaw with string pointer * signer: implement custom 4byte databsae that saves submitted signatures * signer/storage: implement aes-gcm-backed credential storage * accounts: implement json unmarshalling of url * signer: fix listresponse, fix gas->uint64 * node: make http/ipc start methods public * signer: add ipc capability+review concerns * accounts: correct docstring * signer: address review concerns * rpc: go fmt -s * signer: review concerns+ baptize Clef * signer,node: move Start-functions to separate file * signer: formatting
* p2p: add network simulation framework (#14982)Lewis Marshall2017-09-251-50/+14
| | | | | | This commit introduces a network simulation framework which can be used to run simulated networks of devp2p nodes. The intention is to use this for testing protocols, performing benchmarks and visualising emergent network behaviour.
* whisperv5: integrate whisper and add whisper RPC simulatorBas van Kervel2017-06-151-0/+46
|
* rpc: support subscriptions under custom namespacesBas van Kervel2017-04-251-16/+19
|
* all: import "context" instead of "golang.org/x/net/context"Felix Lange2017-03-231-1/+1
| | | | | | | | | | There is no need to depend on the old context package now that the minimum Go version is 1.7. The move to "context" eliminates our weird vendoring setup. Some vendored code still uses golang.org/x/net/context and it is now vendored in the normal way. This change triggered new vet checks around context.WithTimeout which didn't fire with golang.org/x/net/context.
* all: blidly swap out glog to our log15, logs need reworkPéter Szilágyi2017-02-231-20/+19
|
* rpc: send nil on subscription Err channel when Client is closedFelix Lange2017-01-261-1/+4
| | | | | This change makes client subscriptions compatible with the new Subscription semantics introduced in the previous commit.
* rpc: add context argument to EthSubscribeFelix Lange2016-08-061-3/+3
| | | | | It's inconsistent not to pass it and most callers will work with contexts anyway.
* rpc: ensure client doesn't block for slow subscribersFelix Lange2016-08-061-30/+62
| | | | | | | | | | | | | | | | | | | | | I initially made the client block if the 100-element buffer was exceeded. It turns out that this is inconvenient for simple uses of the client which subscribe and perform calls on the same goroutine, e.g. client, _ := rpc.Dial(...) ch := make(chan int) // note: no buffer sub, _ := client.EthSubscribe(ch, "something") for event := range ch { client.Call(...) } This innocent looking code will lock up if the server suddenly decides to send 2000 notifications. In this case, the client's main loop won't accept the call because it is trying to deliver a notification to ch. The issue is kind of hard to explain in the docs and few people will actually read them. Buffering is the simple option and works with close to no overhead for subscribers that always listen.
* rpc: don't exceed context deadline while waiting for send lockFelix Lange2016-08-051-0/+4
|
* rpc: add new client, use it everywhereFelix Lange2016-07-231-0/+740
The new client implementation supports concurrent requests, subscriptions and replaces the various ad hoc RPC clients throughout go-ethereum.