Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(registry): fix a data race in StartRegistryServer() EE-6654 #573

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions edge/registry/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package registry

import (
"errors"
"net"
"net/http"
"net/url"
"strings"
Expand Down Expand Up @@ -100,20 +101,22 @@ func (handler *Handler) LookupHandler(rw http.ResponseWriter, r *http.Request) *
func StartRegistryServer(edgeManager *edge.Manager, awsConfig *agent.AWSConfig) (err error) {
log.Info().Msg("starting registry credential server")

l, err := net.Listen("tcp", "127.0.0.1:9005")
if err != nil {
return err
}

h := NewEdgeRegistryHandler(edgeManager, awsConfig)

server := &http.Server{
Addr: "127.0.0.1:9005",
WriteTimeout: time.Second * 15,
ReadTimeout: time.Second * 15,
IdleTimeout: time.Second * 60,
Handler: h,
}

// run in a goroutine so it doesn't block
go func() {
err = server.ListenAndServe()
}()
go server.Serve(l)

return err
return nil
}
Loading