func sendResponse(c net.Conn, resp *o.TaskResponse) { //FIXME: update retry time on Response o.Debug("Sending Response!") ptr := resp.Encode() p, err := o.Encode(ptr) o.MightFail(err, "Failed to encode response") _, err = p.Send(c) if err != nil { o.Warn("Transmission error: %s", err) c.Close() prequeueResponse(resp) lostConnection <- 1 } else { appendUnacknowledgedResponse(resp) } }
func appendUnacknowledgedResponse(resp *o.TaskResponse) { resp.RetryTime = time.Nanoseconds() + RetryDelay unacknowledgedQueue.PushBack(resp) }