arch codereview

This commit is contained in:
2026-04-25 09:55:34 +03:00
parent 3e19149cb4
commit 7515e0334b
12 changed files with 579 additions and 487 deletions
+18
View File
@@ -0,0 +1,18 @@
#pragma once
#include <unistd.h>
struct Socket {
int fd = -1;
Socket() = default;
explicit Socket(int fd) : fd(fd) {}
~Socket() { if (fd >= 0) close(fd); }
Socket(const Socket&) = delete;
Socket& operator=(const Socket&) = delete;
Socket(Socket&& o) : fd(o.fd) { o.fd = -1; }
operator int() const { return fd; }
bool valid() const { return fd >= 0; }
void release() { fd = -1; }
};