Skip to content

Commit

Permalink
reset buffer after use (k3s-io#4279)
Browse files Browse the repository at this point in the history
Signed-off-by: Brian Downs <brian.downs@gmail.com>
  • Loading branch information
briandowns committed Nov 10, 2021
1 parent 7efaaea commit 3361c52
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/cluster/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ RETRY:
}

files := make(bootstrap.PathsDataformat)

if err := json.NewDecoder(buf).Decode(&files); err != nil {
// This will fail if data is being pulled from old an cluster since
// older clusters used a map[string][]byte for the data structure.
Expand All @@ -254,6 +253,7 @@ RETRY:
return err
}
}
buf.Seek(0, 0)

type update struct {
db, disk, conflict bool
Expand Down
4 changes: 3 additions & 1 deletion pkg/cluster/https.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ func (c *Cluster) initClusterAndHTTPS(ctx context.Context) error {

// Create a HTTP server with the registered request handlers, using logrus for logging
server := http.Server{
Handler: handler}
Handler: handler,
}

if logrus.IsLevelEnabled(logrus.DebugLevel) {
server.ErrorLog = log.New(logrus.StandardLogger().Writer(), "Cluster-Http-Server ", log.LstdFlags)
} else {
Expand Down

0 comments on commit 3361c52

Please sign in to comment.