Add a helper function to compare message source ports.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2012-04-05 15:31:41 +02:00
parent b35a45d1a4
commit 9dc860642f
1 changed files with 7 additions and 2 deletions

9
port.c
View File

@ -129,6 +129,12 @@ static int pid_eq(struct PortIdentity *a, struct PortIdentity *b)
return 0 == memcmp(a, b, sizeof(*a)); return 0 == memcmp(a, b, sizeof(*a));
} }
static int source_pid_eq(struct ptp_message *m1, struct ptp_message *m2)
{
return pid_eq(&m1->header.sourcePortIdentity,
&m2->header.sourcePortIdentity);
}
static int set_tmo(int fd, unsigned int scale, int log_seconds) static int set_tmo(int fd, unsigned int scale, int log_seconds)
{ {
struct itimerspec tmo = { struct itimerspec tmo = {
@ -1001,8 +1007,7 @@ static void port_peer_delay(struct port *p)
if (fup->header.sequenceId != rsp->header.sequenceId) if (fup->header.sequenceId != rsp->header.sequenceId)
return; return;
if (!pid_eq(&fup->header.sourcePortIdentity, if (!source_pid_eq(fup, rsp))
&rsp->header.sourcePortIdentity))
return; return;
/* Process follow up response. */ /* Process follow up response. */