Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Rids Synchronization #459

Merged
merged 3 commits into from
Mar 23, 2018
Merged

Add Rids Synchronization #459

merged 3 commits into from
Mar 23, 2018

Conversation

bah07
Copy link
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
@@ -90,6 +92,7 @@ void OS_StartCounter(keystore *keys)
}

keys->keyentries[i]->fp = fopen(rids_file, "r+");
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
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().

}

/* Reload the global and local count of events */
static void ReloadCounter(const keystore *keys, int id, const char * cid)
Copy link
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.

@@ -315,6 +356,7 @@ char *ReadSecMSG(keystore *keys, char *buffer, char *cleartext, int id, unsigned
keys->keyentries[id]->local = msg_local;

if (rcv_count >= _s_recv_flush) {
ReloadCounter(keys, id, keys->keyentries[id]->id);
Copy link
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.

@@ -462,6 +504,10 @@ size_t CreateSecMSG(const keystore *keys, const char *msg, size_t msg_length, ch
_finmsg[OS_MAXSTR + 1] = '\0';
msg_encrypted[OS_MAXSTR] = '\0';

if (snd_count >= _s_recv_flush) {
ReloadCounter(keys, keys->keysize, SENDER_COUNTER);
Copy link
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
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