dhcp4: use SetReadDeadline, not SetDeadline

fixes https://github.com/rtr7/router7/issues/25

related to https://github.com/mdlayher/raw/issues/42
This commit is contained in:
Michael Stapelberg 2019-03-21 09:18:32 +01:00
parent 33348e1f0d
commit 3765287e97

View File

@ -198,7 +198,7 @@ func (c *Client) dhcpRequest() (*layers.DHCPv4, error) {
}
// Look for DHCPOFFER packet (described in RFC2131 4.3.1):
c.connection.SetDeadline(time.Now().Add(10 * time.Second))
c.connection.SetReadDeadline(time.Now().Add(10 * time.Second))
for {
offer, err := dhcp4.Read(c.connection)
if err != nil {
@ -233,7 +233,7 @@ func (c *Client) dhcpRequest() (*layers.DHCPv4, error) {
return nil, err
}
c.connection.SetDeadline(time.Now().Add(10 * time.Second))
c.connection.SetReadDeadline(time.Now().Add(10 * time.Second))
for {
// Look for DHCPACK packet (described in RFC2131 4.3.1):
ack, err := dhcp4.Read(c.connection)