starcoinorg / starcoin

Starcoin - A Move smart contract blockchain network that scales by layering
Apache License 2.0
1.38k stars 289 forks source link

Cli normal quit when node shutdown. #136

Closed jolestar closed 4 years ago

jolestar commented 4 years ago

RPCClient 实现优雅关闭以及自动重连接。

当 node 关闭时, 正在通过 console 连接的 cli 会 panic :

starcoin% 2020-04-07T19:25:38.824683+08:00 WARN jsonrpc_client_transports::transports::ipc::/Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/jsonrpc-client-transports-14.0.5/src/transports/ipc.rs::27 - IPC client error: Other(Custom { kind: Other, error: "bytes remaining on stream" }

需要改造为正常退出。

nanne007 commented 4 years ago

starcoin% 2020-04-07T19:25:38.824683+08:00 WARN jsonrpc_client_transports::transports::ipc::/Users/jolestar/.cargo/registry/src/github.com-1ecc6299db9ec823/jsonrpc-client-transports-14.0.5/src/transports/ipc.rs::27 - IPC client error: Other(Custom { kind: Other, error: "bytes remaining on stream" }

This's a log recorded by json-rpc library when the ipc channel is gone. Besides this, I didn't see panic on console cli after the node is down.

I make a change in #190 to rpc client which can do auto-reconnect action in ipc mode if rpc request failed due to unix-socket error (socket is lost, or socket io error).

nanne007 commented 4 years ago

Now txfactory can send requests after node restart.

nanne007 commented 4 years ago

closed now.