make socket non-blocking

This commit is contained in:
MihailRis
2024-11-26 17:12:24 +03:00
parent e8b674ca65
commit 18bdce52df
3 changed files with 37 additions and 8 deletions
+5 -2
View File
@@ -40,7 +40,8 @@ namespace network {
class Network {
std::unique_ptr<Requests> requests;
std::vector<std::shared_ptr<Socket>> connections;
std::unordered_map<u64id_t, std::shared_ptr<Socket>> connections;
u64id_t nextConnection = 1;
public:
Network(std::unique_ptr<Requests> requests);
~Network();
@@ -52,7 +53,9 @@ namespace network {
long maxSize=0
);
std::shared_ptr<Socket> connect(const std::string& address, int port);
Socket* getConnection(u64id_t id) const;
u64id_t connect(const std::string& address, int port);
size_t getTotalUpload() const;
size_t getTotalDownload() const;