mirror of
https://github.com/PretendoNetwork/Inkay.git
synced 2026-08-18 11:37:02 +02:00
feat(p2p): Allow overriding the p2p udp port for Minecraft
the idea is that you might port forward this in your router and give yourself NAT type A for free
This commit is contained in:
parent
a1375ca608
commit
22bebff027
10 changed files with 258 additions and 40 deletions
13
src/utils/scope_exit.h
Normal file
13
src/utils/scope_exit.h
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#pragma once
|
||||
#include <functional>
|
||||
|
||||
// https://stackoverflow.com/a/61242721
|
||||
template<typename F>
|
||||
struct scope_exit
|
||||
{
|
||||
F func;
|
||||
explicit scope_exit(F&& f): func(std::forward<F>(f)) {}
|
||||
~scope_exit() { func(); }
|
||||
};
|
||||
|
||||
template<typename F> scope_exit(F&& frv) -> scope_exit<F>;
|
||||
Loading…
Reference in a new issue