When phc2sys is started before ptp4l or it is interrupted before ptp4l has
a chance to reply to its query, the "uds: sendto failed: Connection refused"
message is output. This is not an interesting message.

Also, don't output the "failed to send message" error from pmc_send, as
all transports output errors in their send routine.

Signed-off-by: Jiri Benc <jb...@redhat.com>
---
 pmc_common.c |   12 ++++--------
 uds.c        |    2 +-
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/pmc_common.c b/pmc_common.c
index e52d68f5b5f7..266462575bd8 100644
--- a/pmc_common.c
+++ b/pmc_common.c
@@ -143,19 +143,15 @@ static struct ptp_message *pmc_message(struct pmc *pmc, 
uint8_t action)
 
 static int pmc_send(struct pmc *pmc, struct ptp_message *msg, int pdulen)
 {
-       int cnt, err;
+       int err;
+
        err = msg_pre_send(msg);
        if (err) {
                pr_err("msg_pre_send failed");
                return -1;
        }
-       cnt = transport_send(pmc->transport, &pmc->fdarray, 0,
-                            msg, pdulen, &msg->hwts);
-       if (cnt < 0) {
-               pr_err("failed to send message");
-               return -1;
-       }
-       return 0;
+       return transport_send(pmc->transport, &pmc->fdarray, 0,
+                             msg, pdulen, &msg->hwts);
 }
 
 static int pmc_tlv_datalen(struct pmc *pmc, int id)
diff --git a/uds.c b/uds.c
index dc0dc756f85a..691d9e85db09 100644
--- a/uds.c
+++ b/uds.c
@@ -104,7 +104,7 @@ static int uds_sendto(struct transport *t, struct fdarray 
*fda,
        int cnt, fd = fda->fd[FD_GENERAL];
 
        cnt = sendto(fd, buf, buflen, 0, (struct sockaddr *)addr, addrlen);
-       if (cnt <= 0) {
+       if (cnt <= 0 && errno != ECONNREFUSED) {
                pr_err("uds: sendto failed: %m");
        }
        return cnt;
-- 
1.7.6.5


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to