Skip to content

Add Rids Synchronization#459

Merged
vikman90 merged 3 commits intomasterfrom
dev-ridssync
Mar 23, 2018
Merged

Add Rids Synchronization#459
vikman90 merged 3 commits intomasterfrom
dev-ridssync

Conversation

@bah07
Copy link
Copy Markdown
Contributor

@bah07 bah07 commented Mar 20, 2018

This PR add feature related issue #456

  • Add ino_t inode to store each agent's counter inode
  • ReloadCounter function checks if the inode of the file has changed, if so, reloads the corresponding counters.
  • flush the output buffer of StoreCounter.

@bah07 bah07 changed the title Add Rids Syncronization Add Rids Synchronization Mar 20, 2018
@bah07 bah07 requested a review from vikman90 March 20, 2018 12:47
@vikman90 vikman90 self-assigned this Mar 20, 2018
@vikman90 vikman90 force-pushed the master branch 3 times, most recently from f6871c4 to 5fb02b1 Compare March 22, 2018 19:19
keys->keyentries[i]->inode = File_Inode(rids_file);

/* If nothing is there, try to open as write only */
if (!keys->keyentries[i]->fp) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing File_Inode() here, if fopen() failed. This call may be better after ending the if block (just like you did in ReloadCounter().

Comment thread src/os_crypto/shared/msgs.c Outdated
}

/* Reload the global and local count of events */
static void ReloadCounter(const keystore *keys, int id, const char * cid)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function does not update global_count or local_count. Those variables must be updated instead of the agent counters in the case that id==keysize.

Comment thread src/os_crypto/shared/msgs.c Outdated
keys->keyentries[id]->local = msg_local;

if (rcv_count >= _s_recv_flush) {
ReloadCounter(keys, id, keys->keyentries[id]->id);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The agent counter must be updated before comparing the message counter.

Comment thread src/os_crypto/shared/msgs.c Outdated
msg_encrypted[OS_MAXSTR] = '\0';

if (snd_count >= _s_recv_flush) {
ReloadCounter(keys, keys->keysize, SENDER_COUNTER);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This call must update global_counter and local_counter.

@vikman90 vikman90 merged commit a9d03ff into master Mar 23, 2018
@vikman90 vikman90 deleted the dev-ridssync branch March 23, 2018 03:24
@vikman90
Copy link
Copy Markdown
Member

GJ @bah07 !!

@soynof soynof mentioned this pull request Aug 7, 2023
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants