On Fri, Jun 19, 2020 at 07:33:03PM +0300, Vladimir Oltean wrote:
> Then it is not correct to "continue" the loop, since it will keep
> iterating through the pollfd array for sockets that were closed in the
> meantime.
> And don't we want to set up a fault timer, to clear it eventually?

Ah!  Right you are ...

diff --git a/clock.c b/clock.c
index f43cc2a..a66d189 100644
--- a/clock.c
+++ b/clock.c
@@ -1559,8 +1559,14 @@ int clock_poll(struct clock *c)
        LIST_FOREACH(p, &c->ports, list) {
                /* Let the ports handle their events. */
                for (i = 0; i < N_POLLFD; i++) {
-                       if (cur[i].revents & (POLLIN|POLLPRI)) {
-                               event = port_event(p, i);
+                       if (cur[i].revents & (POLLIN|POLLPRI|POLLERR)) {
+                               if (cur[i].revents & POLLERR) {
+                                       pr_err("port %d: unexpected socket 
error",
+                                              port_number(p));
+                                       event = EV_FAULT_DETECTED;
+                               } else {
+                                       event = port_event(p, i);
+                               }
                                if (EV_STATE_DECISION_EVENT == event) {
                                        c->sde = 1;
                                }


_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to