dhcp: timeout value is set in DHCP daemon

Eventually the timeout value will become a CLI argument

The default timeout was nestled all the way in the lease constructor

This commit is the first step in making the timeout configurable by
moving it to the DHCPLease constructor

Signed-off-by: toby lorne <toby@toby.codes>
This commit is contained in:
toby lorne
2021-01-11 20:53:45 +00:00
parent 48a97a7ad1
commit 3161bb52e0
2 changed files with 16 additions and 7 deletions

View File

@ -26,6 +26,7 @@ import (
"path/filepath"
"runtime"
"sync"
"time"
"github.com/containernetworking/cni/pkg/skel"
"github.com/containernetworking/cni/pkg/types"
@ -63,7 +64,7 @@ func (d *DHCP) Allocate(args *skel.CmdArgs, result *current.Result) error {
clientID := generateClientID(args.ContainerID, conf.Name, args.IfName)
hostNetns := d.hostNetnsPrefix + args.Netns
l, err := AcquireLease(clientID, hostNetns, args.IfName)
l, err := AcquireLease(clientID, hostNetns, args.IfName, 5*time.Second)
if err != nil {
return err
}