Add cflags to makefile, fix cflags
This commit is contained in:
2
Makefile
2
Makefile
@@ -12,7 +12,7 @@ $(NAME): ofiles
|
|||||||
ar rcs $(NAME) $(OFILES)
|
ar rcs $(NAME) $(OFILES)
|
||||||
|
|
||||||
ofiles:
|
ofiles:
|
||||||
g++ -std=c++20 -O -c $(CFILES)
|
g++ $(CFLAGS) -std=c++20 -O -c $(CFILES)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(OFILES)
|
rm -f $(OFILES)
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ void Response::Send(int clientSocket) {
|
|||||||
for (const auto &[key, value] : m_headers) {
|
for (const auto &[key, value] : m_headers) {
|
||||||
ss << key << ": " << value << "\n";
|
ss << key << ": " << value << "\n";
|
||||||
}
|
}
|
||||||
if (m_payload.size() >= 0) {
|
if (m_payload.size() > 0) {
|
||||||
ss << "\n";
|
ss << "\n";
|
||||||
for (auto &byte : m_payload) {
|
for (auto &byte : m_payload) {
|
||||||
char c = static_cast<char>(byte);
|
char c = static_cast<char>(byte);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "router.hpp"
|
#include "router.hpp"
|
||||||
#include "http.hpp"
|
#include "http.hpp"
|
||||||
#include <csignal>
|
#include <csignal>
|
||||||
|
#include <cstdint>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
|
|
||||||
@@ -42,7 +43,7 @@ void Router::QueueClient(int fd) {
|
|||||||
|
|
||||||
void Router::StartThreadLoop() {
|
void Router::StartThreadLoop() {
|
||||||
const uint32_t numThreads = std::thread::hardware_concurrency();
|
const uint32_t numThreads = std::thread::hardware_concurrency();
|
||||||
for (auto i = 0; i < numThreads; ++i) {
|
for (uint32_t i = 0; i < numThreads; ++i) {
|
||||||
m_threads.emplace_back(std::thread(&Router::ThreadLoop, this));
|
m_threads.emplace_back(std::thread(&Router::ThreadLoop, this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -73,7 +74,7 @@ void Router::ThreadLoop() {
|
|||||||
m_clients.pop();
|
m_clients.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
int read = recv(client, buffer.data(), buffer.size(), 0);
|
recv(client, buffer.data(), buffer.size(), 0);
|
||||||
Request req(buffer);
|
Request req(buffer);
|
||||||
Response res = Route(req);
|
Response res = Route(req);
|
||||||
res.Send(client);
|
res.Send(client);
|
||||||
|
|||||||
Reference in New Issue
Block a user