aboutsummaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2016-07-12 23:34:59 +0800
committerFelix Lange <fjl@twurst.com>2016-07-23 05:21:27 +0800
commitc145589f25445b9fb78e4556b17cde29df5b37bb (patch)
tree131dfa6fb162b02dfdba09b9cdb29e40c2153c12 /rpc
parentf58ac2b46b66a81515a119a2b1924a831afdd0c9 (diff)
downloadgo-tangerine-c145589f25445b9fb78e4556b17cde29df5b37bb.tar.gz
go-tangerine-c145589f25445b9fb78e4556b17cde29df5b37bb.tar.zst
go-tangerine-c145589f25445b9fb78e4556b17cde29df5b37bb.zip
rpc: remove grace period when shutting down the server
The server delayed closing of connections for 3s when stopping. This was supposed to allow for slow handlers, but it didn't really work. When geth quits, it will just exit immediately after quitting the server. Removing the timer makes testing easier because all connections will be closed after Stop returns.
Diffstat (limited to 'rpc')
-rw-r--r--rpc/server.go15
1 files changed, 5 insertions, 10 deletions
diff --git a/rpc/server.go b/rpc/server.go
index 7b7d22063..80976ed62 100644
--- a/rpc/server.go
+++ b/rpc/server.go
@@ -21,7 +21,6 @@ import (
"reflect"
"runtime"
"sync/atomic"
- "time"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog"
@@ -30,8 +29,6 @@ import (
)
const (
- stopPendingRequestTimeout = 3 * time.Second // give pending requests stopPendingRequestTimeout the time to finish when the server is stopped
-
notificationBufferSize = 10000 // max buffered notifications before codec is closed
MetadataApi = "rpc"
@@ -240,13 +237,11 @@ func (s *Server) ServeSingleRequest(codec ServerCodec, options CodecOption) {
func (s *Server) Stop() {
if atomic.CompareAndSwapInt32(&s.run, 1, 0) {
glog.V(logger.Debug).Infoln("RPC Server shutdown initiatied")
- time.AfterFunc(stopPendingRequestTimeout, func() {
- s.codecsMu.Lock()
- defer s.codecsMu.Unlock()
- s.codecs.Each(func(c interface{}) bool {
- c.(ServerCodec).Close()
- return true
- })
+ s.codecsMu.Lock()
+ defer s.codecsMu.Unlock()
+ s.codecs.Each(func(c interface{}) bool {
+ c.(ServerCodec).Close()
+ return true
})
}
}