Skip to content

Commit

Permalink
fix: build
Browse files Browse the repository at this point in the history
  • Loading branch information
Tasssadar committed Nov 16, 2023
1 parent 9bbed17 commit bc17e09
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
7 changes: 7 additions & 0 deletions src/rbprotocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ namespace rb {

using namespace rb::internal;

const ProtocolConfig Protocol::DEFAULT_CONFIG = {
.enable_udp = true,
.enable_ws = true,
.ws_register_with_webserver = true,
.udp_port = 42424,
};

Protocol::Protocol(const char* owner, const char* name, const char* description, Protocol::callback_t callback) {
m_owner = owner;
m_name = name;
Expand Down
8 changes: 2 additions & 6 deletions src/rbprotocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <freertos/queue.h>
#include <functional>
#include <string>
#include <mutex>


#include "rbjson.h"
Expand Down Expand Up @@ -64,12 +65,7 @@ class Protocol {
public:
typedef std::function<void(const std::string& cmd, rbjson::Object* pkt)> callback_t;

static constexpr const ProtocolConfig DEFAULT_CONFIG = {
.enable_udp = true,
.enable_ws = true,
.ws_register_with_webserver = true,
.udp_port = 42424,
};
static const ProtocolConfig DEFAULT_CONFIG;

Protocol(const char* owner, const char* name, const char* description, callback_t callback = nullptr);
~Protocol();
Expand Down
8 changes: 3 additions & 5 deletions src/rbwebserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ static void parse_request(int fd, http_request* req) {

int length = strlen(filename);
if (length == 0) {
filename = ".";
filename = (char*)".";
} else {
for (int i = 0; i < length; ++i) {
if (filename[i] == '?') {
Expand Down Expand Up @@ -450,8 +450,7 @@ static void process_serve_file(int fd, struct sockaddr_in* clientaddr, http_requ
int ffd = prepare_gzip(req);
if (ffd <= 0) {
status = 404;
char* msg = "File not found";
client_error(fd, status, "Not found", msg);
client_error(fd, status, "Not found", "File not found");
} else {
fstat(ffd, &sbuf);
if (S_ISREG(sbuf.st_mode)) {
Expand All @@ -464,8 +463,7 @@ static void process_serve_file(int fd, struct sockaddr_in* clientaddr, http_requ
serve_static(fd, ffd, req, sbuf.st_size);
} else {
status = 400;
char* msg = "Unknow Error";
client_error(fd, status, "Error", msg);
client_error(fd, status, "Error", "Unknow Error");
}
close(ffd);
}
Expand Down
1 change: 1 addition & 0 deletions src/rbwifi.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <atomic>
#include <string>

#if defined(ESP_IDF_VERSION_VAL)
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 1, 0)
Expand Down

0 comments on commit bc17e09

Please sign in to comment.