-
Notifications
You must be signed in to change notification settings - Fork 22
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
Crash on event.send() after a while. #97
Comments
This portion of the code looks unfinished in void PsychicEventSourceClient::sendEvent(const char *event) {
if( !this->server() || !this->socket() ){
return;
}
int result;
do {
result = httpd_socket_send(this->server(), this->socket(), event, strlen(event), 0);
} while (result == HTTPD_SOCK_ERR_TIMEOUT);
//if (result < 0)
//error log here
}
Why is there a do while loop? Can't we just do this? void PsychicEventSourceClient::sendEvent(const char *event) {
if( !this->server() || !this->socket() ){return;}
httpd_socket_send(this->server(), this->socket(), event, strlen(event), 0);
} or better bool PsychicEventSourceClient::sendEvent(const char *event) {
if( !this->server() || !this->socket() ){return false;}
int result = httpd_socket_send(this->server(), this->socket(), event, strlen(event), 0);
if( result == HTTPD_SOCK_ERR_INVALID || result == HTTPD_SOCK_ERR_TIMEOUT || result == HTTPD_SOCK_ERR_FAIL ){
return false;
}
return true;
} |
For sure something is fishy in here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi! Amazing lib.
I had a crash on event.send() the last day.
I have this wrapper around
events.send()
This method called frequently.
The crash clearly was in here
The esp was working great. It was up for 2 and a half days but crashed with this error.
Any idea?
The text was updated successfully, but these errors were encountered: