diff --git a/speedy/http/uv/core.hpp b/io/uv/core.hpp similarity index 100% rename from speedy/http/uv/core.hpp rename to io/uv/core.hpp diff --git a/speedy/http/uv/tcpstream.hpp b/io/uv/tcpstream.hpp similarity index 100% rename from speedy/http/uv/tcpstream.hpp rename to io/uv/tcpstream.hpp diff --git a/speedy/http/uv/tcpstream.inl b/io/uv/tcpstream.inl similarity index 100% rename from speedy/http/uv/tcpstream.inl rename to io/uv/tcpstream.inl diff --git a/speedy/http/uv/uv.hpp b/io/uv/uv.hpp similarity index 100% rename from speedy/http/uv/uv.hpp rename to io/uv/uv.hpp diff --git a/speedy/http/uv/uv_error.hpp b/io/uv/uv_error.hpp similarity index 100% rename from speedy/http/uv/uv_error.hpp rename to io/uv/uv_error.hpp diff --git a/speedy/http/uv/uvbuffer.hpp b/io/uv/uvbuffer.hpp similarity index 100% rename from speedy/http/uv/uvbuffer.hpp rename to io/uv/uvbuffer.hpp diff --git a/speedy/http/uv/uvbuffer.inl b/io/uv/uvbuffer.inl similarity index 100% rename from speedy/http/uv/uvbuffer.inl rename to io/uv/uvbuffer.inl diff --git a/speedy/http/uv/uvloop.hpp b/io/uv/uvloop.hpp similarity index 100% rename from speedy/http/uv/uvloop.hpp rename to io/uv/uvloop.hpp diff --git a/speedy/Makefile b/speedy/Makefile index b65199cd2..caecf5cfc 100644 --- a/speedy/Makefile +++ b/speedy/Makefile @@ -1,7 +1,7 @@ CXX=clang++ CFLAGS=-std=c++11 -Wall LDFLAGS=-luv -lhttp_parser -INC=-I./ +INC=-I../ SOURCES=$(wildcard *.cpp) EXECUTABLE=test.out # OBJECTS=$(SOURCES:.cpp=.o) @@ -9,7 +9,7 @@ EXECUTABLE=test.out all: $(EXECUTABLE) $(EXECUTABLE): $(SOURCES) - $(CXX) $(LDFLAGS) $(SOURCES) -o $(EXECUTABLE) $(CFLAGS) + $(CXX) $(LDFLAGS) $(SOURCES) -o $(EXECUTABLE) $(CFLAGS) $(INC) # .cpp.o: # $(CXX) $(CFLAGS) $< -o $@ $(LDFLAGS) $(INC) diff --git a/speedy/http/httpconnection.hpp b/speedy/http/httpconnection.hpp index c5a4b7b26..99c89311b 100644 --- a/speedy/http/httpconnection.hpp +++ b/speedy/http/httpconnection.hpp @@ -1,7 +1,7 @@ #ifndef MEMGRAPH_SERVER_HTTP_CONNECTION_HPP #define MEMGRAPH_SERVER_HTTP_CONNECTION_HPP -#include "uv/uv.hpp" +#include "io/uv/uv.hpp" #include "httpparser.hpp" #include "request.hpp" diff --git a/speedy/http/httpserver.hpp b/speedy/http/httpserver.hpp index 77baf9c2a..25fcc727e 100644 --- a/speedy/http/httpserver.hpp +++ b/speedy/http/httpserver.hpp @@ -4,7 +4,7 @@ #include #include -#include "uv/uv.hpp" +#include "io/uv/uv.hpp" #include "httpparsersettings.hpp" #include "httpconnection.hpp" #include "request.hpp" diff --git a/speedy/http/response.hpp b/speedy/http/response.hpp index 3d8267e96..6062aa2ed 100644 --- a/speedy/http/response.hpp +++ b/speedy/http/response.hpp @@ -3,7 +3,7 @@ #include -#include "uv/uv.hpp" +#include "io/uv/uv.hpp" #include "status_codes.hpp" namespace http diff --git a/speedy/speedy.hpp b/speedy/speedy.hpp index 6f83a8cd1..a208aee5a 100644 --- a/speedy/speedy.hpp +++ b/speedy/speedy.hpp @@ -1,7 +1,7 @@ #ifndef MEMGRAPH_SPEEDY_HPP #define MEMGRAPH_SPEEDY_HPP -#include "http/uv/uv.hpp" +#include "io/uv/uv.hpp" #include "http/http.hpp" namespace speedy @@ -10,11 +10,10 @@ namespace speedy class Speedy { private: - uv::UvLoop loop; http::HttpServer server; http::Ipv4 ip; public: - Speedy(const http::Ipv4& ip); + Speedy(uv::UvLoop& loop, const http::Ipv4& ip); void get(const std::string path, http::request_cb_t callback); void listen(); ~Speedy(); diff --git a/speedy/speedy.inl b/speedy/speedy.inl index 01064cc08..36ebefa58 100644 --- a/speedy/speedy.inl +++ b/speedy/speedy.inl @@ -6,7 +6,7 @@ namespace speedy { -Speedy::Speedy(const http::Ipv4& ip) : server(loop), ip(ip) +Speedy::Speedy(uv::UvLoop& loop, const http::Ipv4& ip) : server(loop), ip(ip) { } @@ -21,8 +21,6 @@ void Speedy::listen() }); std::cout << "Server is UP" << std::endl; - - loop.run(uv::UvLoop::Mode::Default); } Speedy::~Speedy() diff --git a/speedy/test.cpp b/speedy/test.cpp index 0ab1e706b..fc829001f 100644 --- a/speedy/test.cpp +++ b/speedy/test.cpp @@ -4,9 +4,13 @@ int main(void) { + uv::UvLoop loop; http::Ipv4 ip("0.0.0.0", 3400); - speedy::Speedy app(ip); + + speedy::Speedy app(loop, ip); app.listen(); + loop.run(uv::UvLoop::Mode::Default); + return 0; }