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

allow just one connection #22

Closed
fraunhofer-iis-bot opened this issue Sep 24, 2019 · 4 comments
Closed

allow just one connection #22

fraunhofer-iis-bot opened this issue Sep 24, 2019 · 4 comments
Assignees
Labels
Milestone

Comments

@fraunhofer-iis-bot
Copy link
Collaborator

In GitLab by @HTE on Sep 24, 2019, 17:11

It would be good if you can configure the libjapi so that just one connection is allowed (like it was in v1). Then we could detect in our GUI if already someone is connected to the board and it cannot happen that two peaple are working on the same board (could lead to errors).

@fraunhofer-iis-bot
Copy link
Collaborator Author

In GitLab by @cstender on Oct 17, 2019, 14:13

Steps:

  • extend the japi_context by two new variables: uint16_t num_clients and uint16_t max_clients
  • set num_clients = 0; and max_clients = 0 in japi_init()
  • implement a new function called japi_set_max_allowed_clients(uint16_t num)
    • copy num to japi_context->max_clients
    • 0 means no client limit
    • otherwise the number passed to the function is used as the maximum number of allowed clients
  • extend function japi_add_client() to increase japi->num_clients whenever a client is added
  • extend function japu_remove_client() to decrease japu->num_clients whenever a client re moved
  • extend function japi_start_server to check if max_clients was reached
    • at the end of the function new client connections are handled
    • before a new client is added make sure that there are still more clients allowed

@fraunhofer-iis-bot
Copy link
Collaborator Author

In GitLab by @fraunhofer-iis-anon on Oct 17, 2019, 15:52

MR !41

@fraunhofer-iis-bot
Copy link
Collaborator Author

In GitLab by @cstender on Oct 17, 2019, 16:41

Implemented in dev branch.

Just set the maximum number of clients before calling japi_start_server(...), e.g.

japi_set_max_allowed_clients(ctx, 1);

@fraunhofer-iis-bot
Copy link
Collaborator Author

In GitLab by @cstender on Oct 17, 2019, 16:41

closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants