Skip to content

Commit

Permalink
declare regex as global var
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenvechain committed Jun 4, 2024
1 parent bd53134 commit 25c7a8b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion p2psrv/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,9 +392,10 @@ func (s *Server) Options() *Options {
return s.opts
}

var versionRegex = regexp.MustCompile(`\d+\.\d+\.\d+`)

// sameMajor returns true if the peer has the same major version
func sameMajor(appVersion, peerName string) bool {
versionRegex := regexp.MustCompile(`\d+\.\d+\.\d+`)
if appVersion == "" || !versionRegex.MatchString(appVersion) {
// Got a bad app version, so accept any peer
return true
Expand Down

0 comments on commit 25c7a8b

Please sign in to comment.