Skip to content

Commit

Permalink
Merge pull request #38 from cloudstruct/feature/server-handshake
Browse files Browse the repository at this point in the history
Signal that the handshake is complete when acting as server
  • Loading branch information
agaffney authored Mar 8, 2022
2 parents 75a95e7 + 1336cee commit 0d5faa2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions cmd/go-ouroboros-network/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,7 @@ func testServer(f *globalFlags) {
if err != nil {
fmt.Printf("ERROR: %s\n", err)
}
fmt.Printf("handshake completed...disconnecting\n")
conn.Close()
}
}
9 changes: 7 additions & 2 deletions protocol/handshake/handshake.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,16 @@ func (h *Handshake) handleProposeVersions(msgGeneric protocol.Message) error {
}
if highestVersion > 0 {
resp := NewMsgAcceptVersion(highestVersion, versionData)
return h.proto.SendMessage(resp, true)
if err := h.proto.SendMessage(resp, true); err != nil {
return err
}
h.Version = highestVersion
h.Finished <- true
return nil
} else {
// TODO: handle failures
// https://github.com/cloudstruct/go-ouroboros-network/issues/32
return nil
return fmt.Errorf("handshake failed, but we don't yet support this")
}
}

Expand Down

0 comments on commit 0d5faa2

Please sign in to comment.