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

Standby support #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Standby support #1

wants to merge 2 commits into from

Conversation

lars18th
Copy link

Adds support for two new parameters. It enables to run it as a daemon in standby when no clients connected.

root and others added 2 commits March 26, 2018 19:58
Adds the description of new parameters for standby use (daemon).
@lars18th
Copy link
Author

lars18th commented Apr 6, 2018

Hi @slepp ,

You like to merge this? 😕

Copy link
Owner

@slepp slepp left a comment

Choose a reason for hiding this comment

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

Just some thoughts on how the flow is going and some formatting things.


Note: For standby use (for example, when running as a daemon), use both flags `-d -r`.
When running in this way the RTL_TCP is only active (reading samples) when some client is connected.
In any order case, the RTL_TCP and RTLMUX processes are in standby (idle).
Copy link
Owner

Choose a reason for hiding this comment

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

Just a spelling mistake on 'order', which should be 'other'.

@@ -10,4 +10,8 @@ option "port" p "rtl_tcp port"
option "host" h "rtl_tcp host address"
string typestr="address" default="localhost" optional
option "listen" l "Listening port for client connections"
int typestr="port" default="7878" optional
int typestr="port" default="7878" optional option "delayed" d "Delayed
connection to the server"
Copy link
Owner

Choose a reason for hiding this comment

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

This line wrapping (and the next one) causes some issues in formatting for the --help and comments in the cmdline handler.

//bufferevent_free(bev);
//connectToServerSoon(ctx);
//return;
serverInfo.state = SERVER_CONNECTED;
Copy link
Owner

Choose a reason for hiding this comment

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

I don't really see why this is being set to SERVER_CONNECTED when it hasn't actually happened. This would then go on using the buffer and context on a bad connection. It seems you'd likely just want to use the timeToExit = 2 here.

Copy link
Author

Choose a reason for hiding this comment

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

More or less... yes!

if (timeToExit == 2) {
slog(LOG_INFO, SLOG_INFO, "Restarting.");
timeToExit = 0;
goto restart;
Copy link
Owner

Choose a reason for hiding this comment

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

This looks like it could be better handled in just a normal loop, like:

do {
  pthread_create();
  ..
  pthread_join();
  if (timeToExit == 2) {
    slog restarting;
    timeToExit = 0;
  }
} while (timeToExit != 1);

@lars18th
Copy link
Author

Hi,

Sorry, no time for improvements! Feel free to add any modification that you like.
Some comments inline.

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