From: Ferry Huberts Date: Tue, 6 Mar 2012 14:11:11 +0000 (+0100) Subject: PUD: store the best gateway in the transmitGpsInformation X-Git-Tag: OLSRD_0_6_3~143^2~31 X-Git-Url: http://olsr.org/git/?p=olsrd.git;a=commitdiff_plain;h=fd8301c560d5fd2cf1058646935d96e3fd20ff91 PUD: store the best gateway in the transmitGpsInformation Signed-off-by: Ferry Huberts --- diff --git a/lib/pud/src/receiver.c b/lib/pud/src/receiver.c index 8db152a6..f9a66a61 100644 --- a/lib/pud/src/receiver.c +++ b/lib/pud/src/receiver.c @@ -122,6 +122,7 @@ typedef struct _TransmitGpsInformation { bool updated; /**< true when the information was updated */ PositionUpdateEntry txPosition; /**< The last transmitted position */ union olsr_ip_addr txGateway; /**< the best gateway at the time the transmitted position was determined */ + union olsr_ip_addr bestGateway; /**< the current best gateway */ } TransmitGpsInformation; /** The latest position information that is transmitted */ @@ -717,8 +718,11 @@ bool receiverUpdateGpsInformation(unsigned char * rxBuffer, size_t rxCount) { } (void) pthread_mutex_lock(&transmitGpsInformation.mutex); + getBestUplinkGateway(&transmitGpsInformation.bestGateway); + txPosition = transmitGpsInformation.txPosition; txGateway = transmitGpsInformation.txGateway; + bestGateway = transmitGpsInformation.bestGateway; (void) pthread_mutex_unlock(&transmitGpsInformation.mutex); /* parse all NMEA strings in the rxBuffer into the incoming entry */ @@ -768,7 +772,6 @@ bool receiverUpdateGpsInformation(unsigned char * rxBuffer, size_t rxCount) { * Movement detection */ - getBestUplinkGateway(&bestGateway); clearMovementType(&movementResult); detemineMovingFromGateway(&bestGateway, &txGateway, &movementResult); if (movementResult.moving != SET) {