This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head lang='en'> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Trust Certificates | Trust | Untrusted | | Blocked | Macbook Air | 13.3 Inch | Mid-2013</title> | |
</head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "async_socket_connection_handler.hpp" | |
#include <thread> | |
async_socket_connection_handler::async_socket_connection_handler(std::size_t max_con_num_) noexcept | |
: cur_con_num(0) | |
, max_con_num(max_con_num_) { } | |
void async_socket_connection_handler::add_connection(std::int32_t socket) { | |
std::unique_lock<std::mutex> ulock(mtx); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef ASYNC_SOCKET_CONNECTION_HANDLER_HPP_ | |
#define ASYNC_SOCKET_CONNECTION_HANDLER_HPP_ | |
#include <x86_64-linux-gnu/sys/socket.h> | |
#include <x86_64-linux-gnu/sys/unistd.h> | |
#include <netinet/in.h> | |
#include <cstddef> | |
#include <cstring> | |
#include <mutex> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "async_socket_connection_handler.hpp" | |
const std::uint16_t PORT = 1601; | |
int main() { | |
struct sockaddr_in address; | |
std::int32_t addrlen = sizeof(address); | |
std::int32_t server_socket; | |
std::int32_t client_socket; | |
async_socket_connection_handler client_handler(4); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <x86_64-linux-gnu/sys/socket.h> | |
#include <x86_64-linux-gnu/sys/unistd.h> | |
#include <netinet/in.h> | |
#include <iostream> | |
#include <string> | |
const std::uint16_t PORT = 1601; | |
int main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef SMART_POINTERS_HPP_ | |
#define SMART_POINTERS_HPP_ | |
#include <new> | |
#include <cstddef> | |
#include <utility> | |
#include <stdexcept> | |
#include <type_traits> | |
template<class Ty> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
class file_guard final { | |
public: | |
file_guard(HANDLE file_handle_) | |
: file_handle(file_handle_) { } | |
file_guard(file_guard&&) = delete; | |
file_guard& operator=(file_guard&&) = delete; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <memory> | |
#include <x86_64-linux-gnu/sys/socket.h> | |
#include <x86_64-linux-gnu/sys/unistd.h> | |
void socket_deleter_1(int* socket_handle) { | |
if (*socket_handle != -1) { | |
close(*socket_handle); | |
} | |
delete socket_handle; |