-
Notifications
You must be signed in to change notification settings - Fork 103
Open
Description
ResponseTimeout const control message response timeout and it is set to 2 seconds.
While 2 seconds timeout is ok for 1st message, when message is re transmitted the timeout value needs to be increased. Thus, we need to be able to supply custom ResponseTimeout with the request data as it appears to be a higher level function in this API design.
const (
// ResponseTimeout is the amount of time to wait for a
// response.
ResponseTimeout = time.Second * 2
)
// Receive a message.
func Receive(l *net.UDPConn, buf []byte) (Message, error) {
l.SetReadDeadline(time.Now().Add(ResponseTimeout))
nr, _, err := l.ReadFromUDP(buf)
if err != nil {
return Message{}, err
}
return parseMessage(buf[:nr])
}
Metadata
Metadata
Assignees
Labels
No labels