리눅스랑 코드 동기화

This commit is contained in:
2025-05-01 16:33:52 +09:00
parent d3161edb36
commit 4fb5bdd4cb
14 changed files with 279 additions and 144 deletions

View File

@@ -1,28 +1,60 @@
#include "Session/Session.hpp"
namespace Chattr {
Session::Session(Chattr::TCPSocket __sock) {
init(std::move(__sock));
}
Session::~Session() {
destruct();
}
void Session::init(Chattr::TCPSocket __sock) {
}
void Session::destruct() {
}
int Session::send() {
return -1;
}
int Session::recv() {
return -1;
}
}
//#include "Session/Session.hpp"
//#include "Socket/Log.hpp"
//#include "precomp.hpp"
//#include <thread>
//
//namespace Chattr {
//
//Session::Session(Chattr::TCPSocket __sock) {
// init(std::move(__sock));
//}
//
//Session::~Session() {
// destruct();
//}
//
//void Session::init(Chattr::TCPSocket __sock) {
// sock_ = std::move(__sock);
//}
//
//void Session::destruct() {
//}
//
//TCPSocket Session::reconnect(Chattr::TCPSocket __sock, int maxTry) {
// int retVal = 0;
// int backoffTime = 2;
//
// __sock.destruct();
//
// spdlog::info("Lost connection.");
// while (maxTry--) {
// backoffTime *= backoffTime;
// spdlog::info("Attempt to reconnect in {}s...", backoffTime);
// std::this_thread::sleep_for(std::chrono::seconds(backoffTime));
// TCPSocket sock;
//
// retVal = sock.init(__sock.domain);
// if (retVal == INVALID_SOCKET || retVal == SOCKET_ERROR) {
// log::error("init()");
// continue;
// }
// retVal = sock.connect(__sock.remoteAddr);
// if (retVal == INVALID_SOCKET || retVal == SOCKET_ERROR) {
// log::error("connect()");
// continue;
// }
//
// return sock;
// }
// return TCPSocket();
//}
//
//int Session::recv(void* __restrict __buf, size_t __n, int __flags) {
// return -1;
//}
//
//int Session::send(const void* __buf, size_t __n, int __flags) {
// return -1;
//}
//
//}

View File

@@ -0,0 +1,2 @@
// #include "Session/SessionManager.hpp"
#include "precomp.hpp"