summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 49d5b3e)
raw | patch | inline | side by side (parent: 49d5b3e)
author | Arnie Reynoso <arnier@ti.com> | |
Wed, 23 Jul 2014 20:37:40 +0000 (13:37 -0700) | ||
committer | Robert Tivy <rtivy@ti.com> | |
Tue, 5 Aug 2014 17:46:43 +0000 (10:46 -0700) |
This commit fixes the issue in SDOCM00112106 on the Linux side. It
adds a sequence number to NameServer message so that responses can
be properly identified.
adds a sequence number to NameServer message so that responses can
be properly identified.
linux/src/daemon/NameServer_daemon.c | patch | blob | history |
index abaf757f800809cf808bc438ab8e8be84f0248de..7cd2bad14d0e9508712eb9eecfb0bc3b5f5043c7 100644 (file)
int numBytes;
int err;
int i;
+ static int seqNum = 0;
+ Bool done = FALSE;
/* Set Timeout to wait: */
tv.tv_sec = 0;
nsMsg.request = NAMESERVER_REQUEST;
nsMsg.requestStatus = 0;
nsMsg.valueLen = *len;
+ nsMsg.seqNum = seqNum++;
strncpy((char *)nsMsg.instanceName, obj->name, strlen(obj->name) + 1);
strncpy((char *)nsMsg.name, name, strlen(name) + 1);
goto exit;
}
- /* Block on waitFd for signal from listener thread: */
- waitFd = NameServer_module->waitFd;
- FD_ZERO(&rfds);
- FD_SET(waitFd, &rfds);
- maxfd = waitFd + 1;
- LOG1("NameServer_getRemote: pending on waitFd: %d\n", waitFd)
- ret = select(maxfd, &rfds, NULL, NULL, &tv);
- if (ret == -1) {
- LOG0("NameServer_getRemote: select failed.")
- status = NameServer_E_FAIL;
- goto exit;
- }
- else if (!ret) {
- LOG0("NameServer_getRemote: select timed out.\n")
- status = NameServer_E_TIMEOUT;
- goto exit;
- }
+ while (!done) {
+ /* Block on waitFd for signal from listener thread: */
+ waitFd = NameServer_module->waitFd;
+ FD_ZERO(&rfds);
+ FD_SET(waitFd, &rfds);
+ maxfd = waitFd + 1;
+ LOG1("NameServer_getRemote: pending on waitFd: %d\n", waitFd)
+ ret = select(maxfd, &rfds, NULL, NULL, &tv);
+ if (ret == -1) {
+ LOG0("NameServer_getRemote: select failed.")
+ status = NameServer_E_FAIL;
+ goto exit;
+ }
+ else if (!ret) {
+ LOG0("NameServer_getRemote: select timed out.\n")
+ status = NameServer_E_TIMEOUT;
+ goto exit;
+ }
- if (FD_ISSET(waitFd, &rfds)) {
- /* Read, just to balance the write: */
- numBytes = read(waitFd, &buf, sizeof(uint64_t));
+ if (FD_ISSET(waitFd, &rfds)) {
+ /* Read, just to balance the write: */
+ numBytes = read(waitFd, &buf, sizeof(uint64_t));
- /* Process response: */
- replyMsg = &NameServer_module->nsMsg;
+ /* Process response: */
+ replyMsg = &NameServer_module->nsMsg;
- if (replyMsg->requestStatus) {
- /* name is found */
+ if (replyMsg->seqNum != seqNum - 1) {
+ /* Ignore responses without current sequence # */
+ continue;
+ }
- /* set length to amount of data that was copied */
- *len = replyMsg->valueLen;
+ if (replyMsg->requestStatus) {
+ /* name is found */
- /* set the contents of value */
- if (*len <= sizeof (Bits32)) {
- *(UInt32 *)value = (UInt32)replyMsg->value;
- LOG2("NameServer_getRemote: Reply from: %d, %s:",
- procId, (String)replyMsg->instanceName)
- LOG2("%s, value: 0x%x...\n",
- (String)replyMsg->name, *(UInt32 *)value)
- }
- else {
- memcpy(value, replyMsg->valueBuf, *len);
- LOG2("NameServer_getRemote: Reply from: %d, %s:",
- procId, (String)replyMsg->instanceName)
- for (i = 0; i < *len/4; i++) {
- LOG2("%s, value buffer content: 0x%x...\n",
- (String)replyMsg->name, ((uint32_t *)value)[i])
+ /* set length to amount of data that was copied */
+ *len = replyMsg->valueLen;
+
+ /* set the contents of value */
+ if (*len <= sizeof (Bits32)) {
+ *(UInt32 *)value = (UInt32)replyMsg->value;
+ LOG2("NameServer_getRemote: Reply from: %d, %s:",
+ procId, (String)replyMsg->instanceName)
+ LOG2("%s, value: 0x%x...\n",
+ (String)replyMsg->name, *(UInt32 *)value)
+ }
+ else {
+ memcpy(value, replyMsg->valueBuf, *len);
+ LOG2("NameServer_getRemote: Reply from: %d, %s:",
+ procId, (String)replyMsg->instanceName)
+ for (i = 0; i < *len/4; i++) {
+ LOG2("%s, value buffer content: 0x%x...\n",
+ (String)replyMsg->name, ((uint32_t *)value)[i])
+ }
}
- }
- goto exit;
- }
- else {
- /* name is not found */
- LOG2("NameServer_getRemote: value for %s:%s not found.\n",
- (String)replyMsg->instanceName, (String)replyMsg->name)
+ goto exit;
+ }
+ else {
+ /* name is not found */
+ LOG2("NameServer_getRemote: value for %s:%s not found.\n",
+ (String)replyMsg->instanceName, (String)replyMsg->name)
- /* set status to not found */
- status = NameServer_E_NOTFOUND;
+ /* set status to not found */
+ status = NameServer_E_NOTFOUND;
+ }
}
+ done= TRUE;
}
exit: