Skip to content

Commit

Permalink
Add log for GO AWAY
Browse files Browse the repository at this point in the history
  • Loading branch information
dix975 committed Jul 23, 2018
1 parent ec64637 commit 9f5770a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions p2p/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ func (l loggerWriter) Write(p []byte) (n int, err error) {
}

func NewClient(p2pAddr string, chainID eos.SHA256Bytes, networkVersion uint16) *Client {

nodeID := make([]byte, 32)
rand.Read(nodeID)
fmt.Println("Node ID:", hex.EncodeToString(nodeID))

c := &Client{
p2pAddress: p2pAddr,
Expand All @@ -44,7 +44,6 @@ func NewClient(p2pAddr string, chainID eos.SHA256Bytes, networkVersion uint16) *
AgentName: "eos-go client",
// by default, fake being a peer at the same level as the other..
}
c.api = eos.New("http://mainnet.eoscanada.com")
c.NodeID = nodeID
return c
}
Expand All @@ -61,7 +60,6 @@ type Client struct {
AgentName string

LastHandshakeReceived *eos.HandshakeMessage
api *eos.API
}

func (c *Client) ConnectRecent() error {
Expand Down Expand Up @@ -138,6 +136,8 @@ func (c *Client) registerInitHandler(sync bool, headBlock uint32, headBlockID eo
initHandler := HandlerFunc(func(processable Message) {

switch msg := processable.Envelope.P2PMessage.(type) {
case *eos.GoAwayMessage:
fmt.Printf("GO AWAY Reason[%d] \n", msg.Reason)
case *eos.HandshakeMessage:
c.LastHandshakeReceived = msg

Expand Down

0 comments on commit 9f5770a

Please sign in to comment.