mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 21:56:43 +00:00
added ipcexperimental flag to enable the new RPC implementation
This commit is contained in:
parent
5a687c8f4a
commit
3bff502d67
3 changed files with 39 additions and 31 deletions
|
|
@ -313,6 +313,7 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
|
|||
utils.IPCDisabledFlag,
|
||||
utils.IPCApiFlag,
|
||||
utils.IPCPathFlag,
|
||||
utils.IPCExperimental,
|
||||
utils.ExecFlag,
|
||||
utils.WhisperEnabledFlag,
|
||||
utils.DevModeFlag,
|
||||
|
|
|
|||
|
|
@ -158,6 +158,7 @@ var AppHelpFlagGroups = []flagGroup{
|
|||
Flags: []cli.Flag{
|
||||
utils.WhisperEnabledFlag,
|
||||
utils.NatspecEnabledFlag,
|
||||
utils.IPCExperimental,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -305,6 +305,10 @@ var (
|
|||
Usage: "Filename for IPC socket/pipe",
|
||||
Value: DirectoryString{common.DefaultIpcPath()},
|
||||
}
|
||||
IPCExperimental = cli.BoolFlag{
|
||||
Name: "ipcexp",
|
||||
Usage: "Enable the new RPC implementation",
|
||||
}
|
||||
ExecFlag = cli.StringFlag{
|
||||
Name: "exec",
|
||||
Usage: "Execute JavaScript statement (only in combination with console/attach)",
|
||||
|
|
@ -778,7 +782,6 @@ func IpcSocketPath(ctx *cli.Context) (ipcpath string) {
|
|||
return
|
||||
}
|
||||
|
||||
// StartIPC starts a IPC JSON-RPC API server.
|
||||
func StartIPC(stack *node.Node, ctx *cli.Context) error {
|
||||
var ethereum *eth.Ethereum
|
||||
if err := stack.Service(ðereum); err != nil {
|
||||
|
|
@ -788,6 +791,8 @@ func StartIPC(stack *node.Node, ctx *cli.Context) error {
|
|||
if err := stack.Service(&shh); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if ctx.GlobalIsSet(IPCExperimental.Name) {
|
||||
server := rpc.NewServer()
|
||||
|
||||
server.RegisterName("eth", accounts.NewAccountService(ethereum.AccountManager()))
|
||||
|
|
@ -802,16 +807,14 @@ func StartIPC(stack *node.Node, ctx *cli.Context) error {
|
|||
server.RegisterName("personal", accounts.NewPersonalService(ethereum.AccountManager()))
|
||||
server.RegisterName("shh", whisper.NewWhisperService(shh))
|
||||
|
||||
ipcDir := filepath.Join(stack.DataDir(), "shared")
|
||||
os.MkdirAll(ipcDir, 0700)
|
||||
ipcEndpoint := filepath.Join(ipcDir, "ethereum.sock")
|
||||
ipcEndpoint := IpcSocketPath(ctx)
|
||||
os.RemoveAll(ipcEndpoint)
|
||||
l, err := net.ListenUnix("unix", &net.UnixAddr{Name: ipcEndpoint, Net: "unix"})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
return err
|
||||
}
|
||||
go func() {
|
||||
glog.Infof("Unix socket for IPC service opened on %s\n", ipcEndpoint)
|
||||
glog.Infof("IPC endpoint(%s)\n", ipcEndpoint)
|
||||
for {
|
||||
conn, err := l.Accept()
|
||||
if err != nil {
|
||||
|
|
@ -822,6 +825,9 @@ func StartIPC(stack *node.Node, ctx *cli.Context) error {
|
|||
}
|
||||
}()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
config := comms.IpcConfig{
|
||||
Endpoint: IpcSocketPath(ctx),
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue