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

refactor(main): move remaining entry related code #2127

Merged

Conversation

ReenigneArcher
Copy link
Member

Description

This PR moves remaining entry point related code out of main. I wasn't sure of a better way to separate this.

Screenshot

Issues Fixed or Closed

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Dependency update (updates to dependencies)
  • Documentation update (changes to documentation)
  • Repository update (changes to repository files, e.g. .github/...)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the in code docstring/documentation-blocks for new or existing methods/components

Branch Updates

LizardByte requires that branches be up-to-date before merging. This means that after any PR is merged, this branch
must be updated before it can be merged. You must also
Allow edits from maintainers.

  • I want maintainers to keep my branch updated

src/config.cpp Outdated Show resolved Hide resolved
Comment on lines +108 to +104
char **argv;
std::atomic_int desired_exit_code;
Copy link
Member Author

Choose a reason for hiding this comment

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

static was removed from these, as it wouldn't compile.

src/main.cpp Show resolved Hide resolved
src/entry_handler.h Show resolved Hide resolved
@ReenigneArcher ReenigneArcher force-pushed the refactor(main)-move-remaining-entry-related-code branch 2 times, most recently from a82200a to eb78805 Compare February 10, 2024 16:05
@ReenigneArcher ReenigneArcher added this to the Implement Unit Testing milestone Feb 10, 2024
@ReenigneArcher ReenigneArcher force-pushed the refactor(main)-move-remaining-entry-related-code branch from eb78805 to ba2906b Compare February 10, 2024 16:17
Comment on lines +72 to +62
{ "creds"sv, args::creds },
{ "help"sv, args::help },
{ "version"sv, args::version },
#ifdef _WIN32
{ "restore-nvprefs-undo"sv, restore_nvprefs_undo::entry },
{ "restore-nvprefs-undo"sv, args::restore_nvprefs_undo },
Copy link
Member Author

Choose a reason for hiding this comment

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

Refactored CLI args into one namepsace.

@ReenigneArcher ReenigneArcher marked this pull request as ready for review February 10, 2024 16:39
@ReenigneArcher

This comment was marked as resolved.

@ReenigneArcher ReenigneArcher force-pushed the refactor(main)-move-remaining-entry-related-code branch 2 times, most recently from c00d53c to 5310c7d Compare February 10, 2024 19:56
src/stream.cpp Outdated
@@ -18,14 +18,16 @@ extern "C" {
}

#include "config.h"
#include "entry_handler.h"
Copy link
Collaborator

Choose a reason for hiding this comment

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

What entry handler functions are these (stream.cpp, rtsp.cpp, etc) using?

Copy link
Member Author

Choose a reason for hiding this comment

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

Let me double check... it might have been from before I created the globals.

Copy link
Member Author

Choose a reason for hiding this comment

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

Here's a table of the files I added entry_handler to. I'll remove it from the ones without a check.

source file mail nv_prefs_instance lifetime service_ctlr launch_ui launch_ui_with_path
src/audio.cpp
src/config.cpp
src/confighttp.cpp
src/input.cpp
src/nvhttp.cpp
src/platform/linux/audio.cpp
src/platform/linux/misc.cpp
src/platform/linux/x11grab.cpp
src/platform/macos/misc.mm
src/platform/windows/input.cpp
src/platform/windows/misc.cpp
src/rtsp.cpp
src/stream.cpp
src/system_tray.cpp
src/upnp.cpp
src/video.cpp

src/platform/linux/audio.cpp gives the following errors without entry_handler.h:

  • No type named 'thread' in namespace 'std'; did you mean 'boost::thread'?: 201
  • No member named 'thread' in namespace 'std': 238
  • Expected ';' after expression: 238
  • Expected ';' after expression: 239

Probably a better fix than inclduing entry_handler.h exists.

Copy link
Member Author

Choose a reason for hiding this comment

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

Solved audio.cpp by including <thread>

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think moving the whole mail namespace into globals.cpp/h would clean things up nicely. It's a process-wide communication mechanism, so I think it makes sense for it to live with other global state.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good. I'll work on that.

Copy link
Member Author

@ReenigneArcher ReenigneArcher Feb 11, 2024

Choose a reason for hiding this comment

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

Done in a71d3b6

There was no mail in entry_handler.cpp, only in the header.

Copy link
Member Author

Choose a reason for hiding this comment

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

I made a few more tweaks, but I think this is ready now.

  • moved nvprefs_instance to globals
  • added/updated some documentation blocks in globals.cpp and entry_handler.cpp
  • changed the input validation of the creds arg to the just use the help function within the args namespace

@ReenigneArcher ReenigneArcher force-pushed the refactor(main)-move-remaining-entry-related-code branch 3 times, most recently from e7faeb5 to a71d3b6 Compare February 11, 2024 02:28
@ReenigneArcher ReenigneArcher force-pushed the refactor(main)-move-remaining-entry-related-code branch from 5a95c69 to dc2d416 Compare February 11, 2024 14:17
@ReenigneArcher ReenigneArcher merged commit 8689469 into nightly Feb 11, 2024
44 checks passed
@ReenigneArcher ReenigneArcher deleted the refactor(main)-move-remaining-entry-related-code branch February 11, 2024 19:15
KuleRucket pushed a commit to KuleRucket/Sunshine that referenced this pull request Jun 6, 2024
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