Loading net/include/net/module.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ namespace com { struct Folder; } namespace net { inline std::string net_folder_name() { return "net"; } inline std::string folder_name() { return "net"; } void boot(com::Folder* ctx_root); void shutdown(com::Folder* ctx_root); Loading net/include/net/network_types.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ namespace net enum class SendResult : uint8_t { SUCCESS, // Only queued, not yet sent SUCCESS, NOT_CONNECTED, MESSAGE_TOO_LARGE, BUFFER_FULL, Loading net/include/net/socket/gns_socket.hpp +11 −17 Original line number Diff line number Diff line #pragma once // This file uses the GameNetworkingSockets library, developed by Valve https://github.com/ValveSoftware/GameNetworkingSockets // Can be installed via vcpkg #include <GameNetworkingSockets/steam/steamnetworkingsockets.h> #include <GameNetworkingSockets/steam/isteamnetworkingutils.h> #include <net/socket/socket.hpp> #include <net/socket/isocket.hpp> #include <mutex> #include <queue> Loading Loading @@ -37,34 +32,33 @@ namespace net int get_max_message_size() override; private: void on_connection_status_changed(SteamNetConnectionStatusChangedCallback_t* pInfo); static void static_connection_status_changed(SteamNetConnectionStatusChangedCallback_t* pInfo); // Static callback forwarder void on_connection_status_changed(void* pInfo); static void static_connection_status_changed(void* pInfo); // Static callback forwarder static GNSSocket* static_callback_instance; void handle_connection_established(HSteamNetConnection connection); void handle_connection_closed(HSteamNetConnection connection); void handle_connection_established(uint32_t connection); void handle_connection_closed(uint32_t connection); void handle_client_connected(); void handle_new_peer_connection(HSteamNetConnection connection); void handle_new_peer_connection(uint32_t connection); void process_incoming_messages(); HSteamNetConnection get_connection(ConnectionId peer); uint32_t get_connection(ConnectionId peer); ConnectionId generate_peer_id(); static int get_send_flags(ReliabilityMode reliability, OrderingMode ordering); static constexpr ConnectionId SERVER_PEER_ID = 0; ISteamNetworkingSockets* m_interface; HSteamListenSocket m_listen_socket; HSteamNetPollGroup m_poll_group; struct Impl; std::unique_ptr<Impl> m_impl; SocketMode m_mode; ConnectionStatus m_status; int m_port; int m_max_connections; std::unordered_map<ConnectionId, HSteamNetConnection> m_peer_to_connection; std::unordered_map<HSteamNetConnection, ConnectionId> m_connection_to_peer; std::unordered_map<ConnectionId, uint32_t> m_peer_to_connection; std::unordered_map<uint32_t, ConnectionId> m_connection_to_peer; ConnectionId m_next_peer_id = 1; std::queue<std::unique_ptr<NetworkMessage>> m_message_queue; Loading net/include/net/socket/socket.hpp→net/include/net/socket/isocket.hpp +0 −0 File moved. View file net/src/module.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -3,12 +3,12 @@ void net::boot(com::Folder *ctx_root) { auto* const root_net = ctx_root->push_back<com::Folder>(net_folder_name()); auto* const root_net = ctx_root->push_back<com::Folder>(folder_name()); } void net::shutdown(com::Folder *ctx_root) { auto* const root_net = ctx_root->find<com::Folder>(net_folder_name()); auto* const root_net = ctx_root->find<com::Folder>(folder_name()); ctx_root->erase(root_net); } Loading Loading
net/include/net/module.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ namespace com { struct Folder; } namespace net { inline std::string net_folder_name() { return "net"; } inline std::string folder_name() { return "net"; } void boot(com::Folder* ctx_root); void shutdown(com::Folder* ctx_root); Loading
net/include/net/network_types.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ namespace net enum class SendResult : uint8_t { SUCCESS, // Only queued, not yet sent SUCCESS, NOT_CONNECTED, MESSAGE_TOO_LARGE, BUFFER_FULL, Loading
net/include/net/socket/gns_socket.hpp +11 −17 Original line number Diff line number Diff line #pragma once // This file uses the GameNetworkingSockets library, developed by Valve https://github.com/ValveSoftware/GameNetworkingSockets // Can be installed via vcpkg #include <GameNetworkingSockets/steam/steamnetworkingsockets.h> #include <GameNetworkingSockets/steam/isteamnetworkingutils.h> #include <net/socket/socket.hpp> #include <net/socket/isocket.hpp> #include <mutex> #include <queue> Loading Loading @@ -37,34 +32,33 @@ namespace net int get_max_message_size() override; private: void on_connection_status_changed(SteamNetConnectionStatusChangedCallback_t* pInfo); static void static_connection_status_changed(SteamNetConnectionStatusChangedCallback_t* pInfo); // Static callback forwarder void on_connection_status_changed(void* pInfo); static void static_connection_status_changed(void* pInfo); // Static callback forwarder static GNSSocket* static_callback_instance; void handle_connection_established(HSteamNetConnection connection); void handle_connection_closed(HSteamNetConnection connection); void handle_connection_established(uint32_t connection); void handle_connection_closed(uint32_t connection); void handle_client_connected(); void handle_new_peer_connection(HSteamNetConnection connection); void handle_new_peer_connection(uint32_t connection); void process_incoming_messages(); HSteamNetConnection get_connection(ConnectionId peer); uint32_t get_connection(ConnectionId peer); ConnectionId generate_peer_id(); static int get_send_flags(ReliabilityMode reliability, OrderingMode ordering); static constexpr ConnectionId SERVER_PEER_ID = 0; ISteamNetworkingSockets* m_interface; HSteamListenSocket m_listen_socket; HSteamNetPollGroup m_poll_group; struct Impl; std::unique_ptr<Impl> m_impl; SocketMode m_mode; ConnectionStatus m_status; int m_port; int m_max_connections; std::unordered_map<ConnectionId, HSteamNetConnection> m_peer_to_connection; std::unordered_map<HSteamNetConnection, ConnectionId> m_connection_to_peer; std::unordered_map<ConnectionId, uint32_t> m_peer_to_connection; std::unordered_map<uint32_t, ConnectionId> m_connection_to_peer; ConnectionId m_next_peer_id = 1; std::queue<std::unique_ptr<NetworkMessage>> m_message_queue; Loading
net/src/module.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -3,12 +3,12 @@ void net::boot(com::Folder *ctx_root) { auto* const root_net = ctx_root->push_back<com::Folder>(net_folder_name()); auto* const root_net = ctx_root->push_back<com::Folder>(folder_name()); } void net::shutdown(com::Folder *ctx_root) { auto* const root_net = ctx_root->find<com::Folder>(net_folder_name()); auto* const root_net = ctx_root->find<com::Folder>(folder_name()); ctx_root->erase(root_net); } Loading