-
Notifications
You must be signed in to change notification settings - Fork 113
EvseV2G: ensure that connections are only accepted when possible #1402
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
base: main
Are you sure you want to change the base?
Conversation
This is probably needed in ISOMux as well. |
connection_loop.detach(); | ||
} catch (const std::system_error&) { | ||
// unable to start thread | ||
dlog(DLOG_LEVEL_ERROR, "pthread_create() failed: %s", strerror(errno)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ctx->connection_initiated = false;
probably needed if the creation of the thread fails
|
||
if (pthread_create(&conn->thread_id, &attr, connection_handle_tcp, conn) != 0) { | ||
dlog(DLOG_LEVEL_ERROR, "pthread_create() failed: %s", strerror(errno)); | ||
continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ctx->connection_initiated = false; probably needed if the creation of the thread fails
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added this
struct v2g_connection* conn = NULL; | ||
pthread_attr_t attr; | ||
|
||
/* create the thread in detached state so we don't need to join every single one */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps conn->ctx->connection_initiated = false;
is needed to ensure the first connection is allowed.
Depends on whether connection_server() can be called more than once.
…sible If a connection is already established another cannot be handled, so we should not allocate resources (like handler threads) for these connection attempts Signed-off-by: Kai-Uwe Hermann <[email protected]>
Signed-off-by: Kai-Uwe Hermann <[email protected]>
8738a1f
to
de504f0
Compare
Yes, in IsoMux we probably need something similar as well. I don't know how much work it would be to properly support multiple connections, so for now I think this is the best we can do |
Describe your changes
If a connection is already established another cannot be handled, so we should not allocate resources (like handler threads) for these connection attempts
Issue ticket number and link
Checklist before requesting a review