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

Cleanup of stuff #6

Merged
merged 17 commits into from
Aug 1, 2018
Merged

Cleanup of stuff #6

merged 17 commits into from
Aug 1, 2018

Conversation

lenerd
Copy link
Collaborator

@lenerd lenerd commented Jul 17, 2018

This is work in progress.

* Move constant lookup tables.
* Remove declarations of helper template functions from header (template
  definitions are in source file anyway).
* Sort method implementations s.t. they are in the same order as in the
  header.
Move functions as well and remove static keyword.
You do not need typedef structs in C++. This is just annoying for
forward declarations.
* Use member initializer list.
* Use unique_ptr for CLock* members.
The functions can be replaced with standard library functionality:
* std::filesystem::exists
* std::filesystem::file_size
* std::filesystem::is_empty
* Move implementation to .cpp file
I have no idea if the Windows implementation still works.
* Removed CGrabLock which can be replaced with std::lock_guard and
  CThread::Kill which is unused and misleading.
* The mutex is marked as `mutable` s.t. it can be locked in a const
  method (e.g. IsSet).
* Add CLock::lock and Clock::unlock s.t. CLock can be used with
  std::lock_guard etc.
This should prevent a race when flush_queue is executed while the thread
is still running and possibly adding more items to the queue.
The access from crypto::gen_rnd is now synchronized.
Each queue in a `rcv_task` has now an accompanying mutex which is used
by the `RcvThread` and `channel`s.
Adds mutexes for send/recv counters as they are often used from other
threads. Also make methods const if possible.
@lenerd lenerd merged commit 17f026a into encryptogroup:master Aug 1, 2018
@lenerd lenerd changed the title Cleanup of stuff (WIP) Cleanup of stuff Aug 1, 2018
@lenerd lenerd deleted the lenerd/cleanup branch August 1, 2018 17:04
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.

None yet

1 participant