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

Prevent Psychic from committing a suicide: the object already cleanup its resources when going out of scope or deleted externally by the user #126

Merged
merged 1 commit into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions src/PsychicHttpServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ PsychicHttpServer::PsychicHttpServer() :
config.close_fn = PsychicHttpServer::closeCallback;
config.uri_match_fn = httpd_uri_match_wildcard;
config.global_user_ctx = this;
config.global_user_ctx_free_fn = destroy;
config.max_uri_handlers = 20;

#ifdef ENABLE_ASYNC
Expand Down Expand Up @@ -54,12 +53,6 @@ PsychicHttpServer::~PsychicHttpServer()
delete defaultEndpoint;
}

void PsychicHttpServer::destroy(void *ctx)
{
PsychicHttpServer *temp = (PsychicHttpServer *)ctx;
delete temp;
}

esp_err_t PsychicHttpServer::listen(uint16_t port)
{
this->_use_ssl = false;
Expand Down
2 changes: 0 additions & 2 deletions src/PsychicHttpServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ class PsychicHttpServer

PsychicEndpoint *defaultEndpoint;

static void destroy(void *ctx);

esp_err_t listen(uint16_t port);

virtual void stop();
Expand Down
1 change: 0 additions & 1 deletion src/PsychicHttpsServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ PsychicHttpsServer::PsychicHttpsServer() : PsychicHttpServer()
ssl_config.httpd.close_fn = PsychicHttpServer::closeCallback;
ssl_config.httpd.uri_match_fn = httpd_uri_match_wildcard;
ssl_config.httpd.global_user_ctx = this;
ssl_config.httpd.global_user_ctx_free_fn = destroy;
ssl_config.httpd.max_uri_handlers = 20;

// each SSL connection takes about 45kb of heap
Expand Down
Loading