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

Daemon Hooking #353

Merged
merged 29 commits into from
Jul 6, 2022
Merged

Conversation

Camerooooon
Copy link
Collaborator

No description provided.

@JakeRoggenbuck
Copy link
Owner

Yay! very well done!

@Camerooooon
Copy link
Collaborator Author

Camerooooon commented Jun 26, 2022

The solution that I decided to use was to replace most of the references to the Daemon with references to an Arc<Mutex<Daemon>> which is what I would say is a "wrapper struct" that "surrounds" the daemon. This struct controls which thread is allowed to read and write to the object (in this case the daemon). A thread can request to read/write data by performing a "lock" on the data which basically says to whatever thread is requesting the data that it needs to wait for the main thread to stop using the data (in this case if the main thread is utilizing the data the socket thread will wait for the request to finish before proceeding thereby holding up the socket thread which is not a problem since our acs client can be patient).

@Camerooooon
Copy link
Collaborator Author

I've implemented the command listening and parsing. You can now use socat to broadcast 0|test hello following the protocol outlines.

@Camerooooon
Copy link
Collaborator Author

Ok, this PR is almost complete. It needs a LOT of reviews there are so many situations where it can break and it's quite unstable.

@Camerooooon Camerooooon requested review from Shuzhengz and JakeRoggenbuck and removed request for Shuzhengz June 28, 2022 06:01
@Camerooooon Camerooooon added the Needs laptop test We need to test this on a laptop label Jun 28, 2022
@Camerooooon Camerooooon requested a review from Shuzhengz June 28, 2022 06:01
@Camerooooon Camerooooon removed the Needs laptop test We need to test this on a laptop label Jun 28, 2022
@Shuzhengz
Copy link
Collaborator

Shuzhengz commented Jun 28, 2022

its still a draft pr cant review

@Camerooooon Camerooooon marked this pull request as ready for review June 28, 2022 14:35
Copy link
Collaborator

@Shuzhengz Shuzhengz left a comment

Choose a reason for hiding this comment

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

also don't forget about cargo fmt

src/daemon.rs Show resolved Hide resolved
src/network.rs Show resolved Hide resolved
@JakeRoggenbuck
Copy link
Owner

This looks very close to being done, if not already done. Anything else you think would be good to add?

@Camerooooon
Copy link
Collaborator Author

This looks very close to being done, if not already done. Anything else you think would be good to add?

It needs to be stabilized lots of unhandled exceptions.

@Camerooooon
Copy link
Collaborator Author

Almost done, just fixed a major bug!

@Camerooooon
Copy link
Collaborator Author

Looks like we are go for review @JakeRoggenbuck and @Shuzhengz! The daemon hooking is working, please re-review then merge this!

@JakeRoggenbuck
Copy link
Owner

Looks like we are go for review @JakeRoggenbuck and @Shuzhengz! The daemon hooking is working, please re-review then merge this!

Awesome!

@JakeRoggenbuck
Copy link
Owner

What is a good way to test the sending to the socket?

@Camerooooon
Copy link
Collaborator Author

Camerooooon commented Jul 2, 2022

Cargo monit attempts to send the hello packet. It will then print out the response to std out ( you will need to scroll up because it gets pushed away by the TUI ) you can test by reading that response. Additionally you can use socat to manually attach to the sock and send packets yourself.

@JakeRoggenbuck
Copy link
Owner

Tested, everything seems good.

Copy link
Owner

@JakeRoggenbuck JakeRoggenbuck left a comment

Choose a reason for hiding this comment

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

Great!

@JakeRoggenbuck JakeRoggenbuck merged commit 03b6af5 into JakeRoggenbuck:main Jul 6, 2022
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.

3 participants