Skip to content

Commit

Permalink
fix crash of console and block of Close (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
bxq2011hust authored Oct 21, 2020
1 parent f63b007 commit 6a4b272
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions cmd/commandline/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -749,8 +749,8 @@ func init() {
// add contract command

// cobra.OnInitialize(initConfig)
helpCmd, _, _ := rootCmd.Find([]string{"help"})
helpCmd.PersistentPreRun = nil

// FIXME: add a custom help command or find a way to make help command work without network

// Here you will define your flags and configuration settings.
// Cobra supports persistent flags, which, if defined here,
Expand Down
13 changes: 8 additions & 5 deletions conn/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,14 @@ func (c *Connection) Close() {
if c.isHTTP {
return
}
select {
case c.close <- struct{}{}:
<-c.didClose
case <-c.didClose:
}
hc := c.writeConn.(*channelSession)
hc.Close()
// FIXME: remove substration releated code
// select {
// case c.close <- struct{}{}:
// <-c.didClose
// case <-c.didClose:
// }
}

// Call performs a JSON-RPC call with the given arguments and unmarshals into
Expand Down

0 comments on commit 6a4b272

Please sign in to comment.