mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-09-01 18:53:17 +00:00
better
This commit is contained in:
@@ -554,8 +554,12 @@ std::pair<s32, Network::Errno> BSD::SocketImpl(Network::Domain domain, Network::
|
|||||||
// TODO: rework this so proxy sockets can be done transparently? -- like what if i need
|
// TODO: rework this so proxy sockets can be done transparently? -- like what if i need
|
||||||
// to browse the internet while playing LDN or something stupid like that?
|
// to browse the internet while playing LDN or something stupid like that?
|
||||||
auto room_member = Network::GetRoomMember().lock();
|
auto room_member = Network::GetRoomMember().lock();
|
||||||
if (protocol == Network::Protocol::ICMP || protocol == Network::Protocol::ICMPV6) {
|
if (0) {
|
||||||
|
// ...only unix has this issue it seems, ICMP works otherwise fine on win
|
||||||
|
#ifdef __unix__
|
||||||
|
} else if (protocol == Network::Protocol::ICMP || protocol == Network::Protocol::ICMPV6) {
|
||||||
descriptor.socket = std::make_shared<Network::IcmpSocket>();
|
descriptor.socket = std::make_shared<Network::IcmpSocket>();
|
||||||
|
#endif
|
||||||
} else if (room_member && room_member->IsConnected()) {
|
} else if (room_member && room_member->IsConnected()) {
|
||||||
descriptor.socket = std::make_shared<Network::ProxySocket>();
|
descriptor.socket = std::make_shared<Network::ProxySocket>();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -93,13 +93,17 @@ std::pair<s32, Errno> IcmpSocket::RecvFrom(int flags, std::span<u8> message, Net
|
|||||||
LOG_DEBUG(Network, "(stubbed) called");
|
LOG_DEBUG(Network, "(stubbed) called");
|
||||||
ASSERT(flags == 0);
|
ASSERT(flags == 0);
|
||||||
ASSERT(message.size() < std::size_t((std::numeric_limits<int>::max)()));
|
ASSERT(message.size() < std::size_t((std::numeric_limits<int>::max)()));
|
||||||
#ifdef __unix__
|
#if !defined(__OPENORBIS__) && (defined(__FreeBSD__) || defined(__linux__))
|
||||||
if (addr) {
|
if (addr) {
|
||||||
if (seq_ident.empty())
|
if (seq_ident.empty())
|
||||||
return {0, Errno::SUCCESS};
|
return {0, Errno::SUCCESS};
|
||||||
// PLEASE DON'T KILL ME, I SWEAR THIS IS LEGITIMATELY THE BEST WAY TO DO IT
|
// PLEASE DON'T KILL ME, I SWEAR THIS IS LEGITIMATELY THE BEST WAY TO DO IT
|
||||||
// IF YOU OPEN socket() GOOGLE WILL STRAIGHT UP IP BAN YOU AFTER 2 HOURS
|
// IF YOU OPEN socket() GOOGLE WILL STRAIGHT UP IP BAN YOU AFTER 2 HOURS
|
||||||
|
#ifdef __FreeBSD__
|
||||||
auto const cmd = fmt::format("ping -t 3 -o {}.{}.{}.{}", addr->ip[0], addr->ip[1], addr->ip[2], addr->ip[3]);
|
auto const cmd = fmt::format("ping -t 3 -o {}.{}.{}.{}", addr->ip[0], addr->ip[1], addr->ip[2], addr->ip[3]);
|
||||||
|
#elif defined(__linux__)
|
||||||
|
auto const cmd = fmt::format("ping -c 1 -W 3 {}.{}.{}.{}", addr->ip[0], addr->ip[1], addr->ip[2], addr->ip[3]);
|
||||||
|
#endif
|
||||||
if (::system(cmd.c_str()) == 0) {
|
if (::system(cmd.c_str()) == 0) {
|
||||||
std::vector<u8> data{
|
std::vector<u8> data{
|
||||||
8,
|
8,
|
||||||
|
|||||||
Reference in New Issue
Block a user