- /* If we can't send, try to start daemon and resend message */
- loop = SEND_WAIT_MAX_SECONDS * SEND_WAIT_LOOP_PER_SECOND;
- while (--loop) {
- retval = sendto(sock, &usend_msg, usend_msg_len, 0, (struct sockaddr *)&saddr, addrlen);
- if (retval != -1) {
- retval = 0;
- goto exit;
- }
-
- if (errno != ECONNREFUSED) {
- dbg("error sending message (%s)", strerror(errno));
- goto fallback;
- }
-
- if (!started_daemon) {
- dbg("try to start udevd daemon");
- retval = start_daemon();
- if (retval) {
- info("error starting daemon");
- goto fallback;
- }
- info("udevd daemon started");
- started_daemon = 1;
- } else {
- dbg("retry to connect %d", SEND_WAIT_MAX_SECONDS * SEND_WAIT_LOOP_PER_SECOND - loop);
- usleep(1000 * 1000 / SEND_WAIT_LOOP_PER_SECOND);
- }
+ if (sendto(sock, &usend_msg, usend_msg_len, 0, (struct sockaddr *)&saddr, addrlen) < 0) {
+ retval = 3;
+ err("error sending message: %s", strerror(errno));