aboutsummaryrefslogtreecommitdiff
path: root/rpc/server.go
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2020-09-15 23:55:34 -0400
committerDeterminant <[email protected]>2020-09-15 23:55:34 -0400
commit78745551c077bf54151202138c2629f288769561 (patch)
tree2b628e99fd110617089778fa91235ecd2888f4ef /rpc/server.go
parent7d1388c743b4ec8f4a86bea95bfada785dee83f7 (diff)
WIP: geth-tavum
Diffstat (limited to 'rpc/server.go')
-rw-r--r--rpc/server.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/rpc/server.go b/rpc/server.go
index bf5d93e..64e078a 100644
--- a/rpc/server.go
+++ b/rpc/server.go
@@ -22,7 +22,7 @@ import (
"sync/atomic"
mapset "github.com/deckarep/golang-set"
- "github.com/ava-labs/go-ethereum/log"
+ "github.com/ethereum/go-ethereum/log"
)
const MetadataApi = "rpc"
@@ -36,7 +36,7 @@ const (
// OptionMethodInvocation is an indication that the codec supports RPC method calls
OptionMethodInvocation CodecOption = 1 << iota
- // OptionSubscriptions is an indication that the codec suports RPC notifications
+ // OptionSubscriptions is an indication that the codec supports RPC notifications
OptionSubscriptions = 1 << iota // support pub sub
)
@@ -72,7 +72,7 @@ func (s *Server) RegisterName(name string, receiver interface{}) error {
//
// Note that codec options are no longer supported.
func (s *Server) ServeCodec(codec ServerCodec, options CodecOption) {
- defer codec.Close()
+ defer codec.close()
// Don't serve if server is stopped.
if atomic.LoadInt32(&s.run) == 0 {
@@ -84,7 +84,7 @@ func (s *Server) ServeCodec(codec ServerCodec, options CodecOption) {
defer s.codecs.Remove(codec)
c := initClient(codec, s.idgen, &s.services)
- <-codec.Closed()
+ <-codec.closed()
c.Close()
}
@@ -101,10 +101,10 @@ func (s *Server) serveSingleRequest(ctx context.Context, codec ServerCodec) {
h.allowSubscribe = false
defer h.close(io.EOF, nil)
- reqs, batch, err := codec.Read()
+ reqs, batch, err := codec.readBatch()
if err != nil {
if err != io.EOF {
- codec.Write(ctx, errorMessage(&invalidMessageError{"parse error"}))
+ codec.writeJSON(ctx, errorMessage(&invalidMessageError{"parse error"}))
}
return
}
@@ -122,7 +122,7 @@ func (s *Server) Stop() {
if atomic.CompareAndSwapInt32(&s.run, 1, 0) {
log.Debug("RPC server shutting down")
s.codecs.Each(func(c interface{}) bool {
- c.(ServerCodec).Close()
+ c.(ServerCodec).close()
return true
})
}