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

Rev 1 #7

Closed
wants to merge 61 commits into from
Closed

Rev 1 #7

wants to merge 61 commits into from

Conversation

OcelotEmpire
Copy link
Contributor

No description provided.

@OcelotEmpire OcelotEmpire self-assigned this Jan 20, 2024
Copy link
Contributor

@ClayJay3 ClayJay3 left a comment

Choose a reason for hiding this comment

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

Nice job on being the first one to have a PR! A majority of the code needs comments, you should be able to read through your comments in English and understand what the code does. Who knows, you might catch a few bugs just going back through and commenting everything! Testing to make sure everything works is needed.

It also appears that the check are failing now. It seems there's a multiple definition of a lock_guard somewhere.

src/RoveComm/Consts.h Show resolved Hide resolved
src/RoveComm/RoveCommConstants.h Show resolved Hide resolved

namespace rovecomm
{
const int ROVECOMM_ETHERNET_UDP_MAX_SUBSCRIBERS = 10;
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a comment to the end of each line explaining what the constants does. Similar to how AutonomyConstants.h is written.

namespace System
{
// pass to RoveCommServer::Fetch() signifying any data id. This is not a valid data id.
const int ANY = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

This constant name is not very descriptive.

const int ROVECOMM_VERSION = 3;
const int ROVECOMM_ETHERNET_TCP_MAX_CONNECTIONS = 5;

namespace System
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this namespace here? Needs docs to explain what it is for.

Copy link
Member

Choose a reason for hiding this comment

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

If you are going to keep this namespace make sure it is written in lowercase.

src/RoveComm/RoveCommServer.h Outdated Show resolved Hide resolved
src/RoveCommGlobals.cpp Show resolved Hide resolved
src/RoveCommGlobals.h Show resolved Hide resolved
src/RoveCommLogging.cpp Show resolved Hide resolved
src/RoveCommLogging.h Show resolved Hide resolved
@ClayJay3 ClayJay3 requested a review from ThisIsBrady January 24, 2024 00:14
Copy link
Member

@Byrdman32 Byrdman32 left a comment

Choose a reason for hiding this comment

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

When writing log statements, think about what you would want to see printed to the console when running an application that includes RoveComm. At the current moment, I am thinking that there is going to be a lot of excess data in the console so I would advise making some of the logs that are currently, LOG_INFO be LOG_DEBUG so that when everything is working well we don't have an overwhelmed console.

Overall, just make sure to review the API Docs, https://missourimrdt.github.io/Autonomy_Software/md_CONTRIBUTING.html, for Autonomy to make sure that your naming conventions are correct.

src/RoveComm/Consts.h Show resolved Hide resolved
src/RoveComm/LogHack.h Outdated Show resolved Hide resolved
src/RoveComm/LogHack.h Outdated Show resolved Hide resolved
src/RoveComm/LogHack.h Outdated Show resolved Hide resolved
#include "RoveCommPacket.h"
#include "RoveCommServer.h"

extern RoveCommServerManager RoveComm;
Copy link
Member

Choose a reason for hiding this comment

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

The purpose of this file is you include "RoveComm.h" in your external project however, the RoveComm Object shouldn't be created here.

* @brief Base class for network thread management.
*
* @file RoveCommPacket.h
* @author Eli Byrd ([email protected])
Copy link
Member

Choose a reason for hiding this comment

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

Add yourself as an author to this header.


// TODO: make this a real singleton ^^^

#endif
Copy link
Member

Choose a reason for hiding this comment

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

Add guard lock comment

@@ -1,89 +1,10 @@
/******************************************************************************
Copy link
Member

Choose a reason for hiding this comment

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

This header should be added back.

*
*
* @file RoveCommGlobals.cpp
* @author Eli Byrd ([email protected])
Copy link
Member

Choose a reason for hiding this comment

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

But also add your name as an author

* distributed into other projects.
*
* @file AutonomyLogging.cpp
* @author Eli Byrd ([email protected])
Copy link
Member

Choose a reason for hiding this comment

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

Add yourself as an author to this header.

// result will actually be a linked list but for now we just get the first entry
if (int status = getaddrinfo(NULL, std::to_string(m_unPort).c_str(), &hints, &result) != 0)
{
LOG_ERROR(logging::g_qSharedLogger, "Failed to find IP! Error: {}", gai_strerror(status));
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 returns a human-readable description of the error that corresponds to the status. I would recommend keeping it and potentially also printing the integer status.

src/RoveComm/RoveCommEthernetTcp.cpp Outdated Show resolved Hide resolved
close(m_nListeningSocket);
continue;
}
break;
Copy link
Member

Choose a reason for hiding this comment

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

This break means that the for loop will only execute a single iteration

src/RoveComm/RoveCommEthernetTcp.cpp Outdated Show resolved Hide resolved
src/RoveComm/RoveCommEthernetTcp.cpp Outdated Show resolved Hide resolved
src/RoveComm/RoveCommEthernetTcp.cpp Outdated Show resolved Hide resolved
// result will actually be a linked list but for now we just get the first entry
if (int status = getaddrinfo(NULL, std::to_string(m_unPort).c_str(), &hints, &result) != 0)
{
LOG_ERROR(logging::g_qSharedLogger, "Failed to find IP! Error: {}", gai_strerror(status));
Copy link
Member

Choose a reason for hiding this comment

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

function returns human readable description of error instead of just the integer status. I'd recommend keeping it.


if (int status = getaddrinfo(address.GetIp().ToString().c_str(), std::to_string(m_unPort).c_str(), &hints, &result) != 0)
{
LOG_ERROR(logging::g_qSharedLogger, "Failed to find IP! Error: {}", gai_strerror(status));
Copy link
Member

Choose a reason for hiding this comment

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

Produces human-readable error message instead of integer status code.

src/RoveComm/RoveCommEthernetUdp.cpp Outdated Show resolved Hide resolved
src/RoveComm/RoveCommServer.cpp Outdated Show resolved Hide resolved
@ClayJay3 ClayJay3 closed this Mar 21, 2024
@ClayJay3
Copy link
Contributor

Closing the PR for now, comments are still available. Reopen or recreate if you want to finish merging.

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.

7 participants