mirror of
https://github.com/Mercantec-GHC/h5-projekt-mst.git
synced 2026-08-27 05:37:39 +02:00
delete unused files
This commit is contained in:
parent
3646c5bf90
commit
bd09668dc1
@ -1,23 +0,0 @@
|
|||||||
#include "http.h"
|
|
||||||
|
|
||||||
namespace mst {
|
|
||||||
auto HttpServer::start() -> Result<void>
|
|
||||||
{
|
|
||||||
while (1) {
|
|
||||||
auto res = this->listener.accept();
|
|
||||||
if (res) { }
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
auto HttpServer::bind(const std::string& host, uint16_t port)
|
|
||||||
-> Result<HttpServer>
|
|
||||||
{
|
|
||||||
auto x = TcpListener::bind(host, port);
|
|
||||||
|
|
||||||
if (!x) {
|
|
||||||
return std::unexpected(std::move(x.error()));
|
|
||||||
}
|
|
||||||
|
|
||||||
return HttpServer(*x);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "tcp.h"
|
|
||||||
#include <cstdint>
|
|
||||||
#include <expected>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
namespace mst {
|
|
||||||
template <typename T> using Result = std::expected<T, std::string>;
|
|
||||||
|
|
||||||
class HttpServer;
|
|
||||||
|
|
||||||
class HttpDaemon {
|
|
||||||
|
|
||||||
public:
|
|
||||||
HttpDaemon(HttpServer&, TcpConnection connection)
|
|
||||||
: connection(connection) { };
|
|
||||||
|
|
||||||
private:
|
|
||||||
TcpConnection connection;
|
|
||||||
};
|
|
||||||
|
|
||||||
class HttpServer {
|
|
||||||
|
|
||||||
public:
|
|
||||||
auto start() -> Result<void>;
|
|
||||||
static auto bind(const std::string& host, uint16_t port)
|
|
||||||
-> Result<HttpServer>;
|
|
||||||
|
|
||||||
private:
|
|
||||||
HttpServer(TcpListener listener)
|
|
||||||
: listener(listener) { };
|
|
||||||
TcpListener listener;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
#include "tcp.h"
|
#include "tcp.hpp"
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user