added RPC start/stop support

This commit is contained in:
Bas van Kervel
2015-06-22 12:47:32 +02:00
parent 2737baa657
commit 2e0b56a72b
31 changed files with 224 additions and 130 deletions

View File

@ -10,7 +10,6 @@ import (
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/rpc/api"
"github.com/ethereum/go-ethereum/rpc/codec"
"github.com/ethereum/go-ethereum/rpc/shared"
"github.com/rs/cors"
@ -28,7 +27,7 @@ type HttpConfig struct {
CorsDomain string
}
func StartHttp(cfg HttpConfig, codec codec.Codec, apis ...api.EthereumApi) error {
func StartHttp(cfg HttpConfig, codec codec.Codec, api shared.EthereumApi) error {
if httpListener != nil {
if fmt.Sprintf("%s:%d", cfg.ListenAddress, cfg.ListenPort) != httpListener.Addr().String() {
return fmt.Errorf("RPC service already running on %s ", httpListener.Addr().String())
@ -43,7 +42,6 @@ func StartHttp(cfg HttpConfig, codec codec.Codec, apis ...api.EthereumApi) error
}
httpListener = l
api := api.Merge(apis...)
var handler http.Handler
if len(cfg.CorsDomain) > 0 {
var opts cors.Options