"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "pkg/server/service/loadbalancer/wrr/wrr.go" between
traefik-v2.3.2.src.tar.gz and traefik-v2.3.3.src.tar.gz

About: Traefik is a cloud native edge router, a reverse proxy and load balancer for HTTP and TCP-based applications.

wrr.go  (traefik-v2.3.2.src):wrr.go  (traefik-v2.3.3.src)
package wrr package wrr
import ( import (
"container/heap" "container/heap"
"errors"
"fmt" "fmt"
"net/http" "net/http"
"sync" "sync"
"github.com/traefik/traefik/v2/pkg/config/dynamic" "github.com/traefik/traefik/v2/pkg/config/dynamic"
"github.com/traefik/traefik/v2/pkg/log" "github.com/traefik/traefik/v2/pkg/log"
) )
type namedHandler struct { type namedHandler struct {
http.Handler http.Handler
skipping to change at line 108 skipping to change at line 109
heap.Push(b, handler) heap.Push(b, handler)
log.WithoutContext().Debugf("Service selected by WRR: %s", handler.name) log.WithoutContext().Debugf("Service selected by WRR: %s", handler.name)
return handler, nil return handler, nil
} }
func (b *Balancer) ServeHTTP(w http.ResponseWriter, req *http.Request) { func (b *Balancer) ServeHTTP(w http.ResponseWriter, req *http.Request) {
if b.stickyCookie != nil { if b.stickyCookie != nil {
cookie, err := req.Cookie(b.stickyCookie.name) cookie, err := req.Cookie(b.stickyCookie.name)
if err != nil && err != http.ErrNoCookie { if err != nil && !errors.Is(err, http.ErrNoCookie) {
log.WithoutContext().Warnf("Error while reading cookie: % v", err) log.WithoutContext().Warnf("Error while reading cookie: % v", err)
} }
if err == nil && cookie != nil { if err == nil && cookie != nil {
for _, handler := range b.handlers { for _, handler := range b.handlers {
if handler.name == cookie.Value { if handler.name == cookie.Value {
handler.ServeHTTP(w, req) handler.ServeHTTP(w, req)
return return
} }
} }
 End of changes. 2 change blocks. 
1 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)