Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't add logs to the message queue on Wii U #61

Merged
merged 3 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions source/log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace
constexpr auto MAX_LOGS = 250;
#else
/// \brief Maximum number of log messages to keep
constexpr auto MAX_LOGS = 10000;
constexpr auto MAX_LOGS = 100;
#endif

#ifdef CLASSIC
Expand Down Expand Up @@ -97,9 +97,7 @@ void drawLog ()
#endif

auto const maxLogs =
#ifdef __WIIU__
1000;
#elif defined(CLASSIC)
#if defined(CLASSIC) && !defined(__WIIU__)
g_logConsole.windowHeight;
#else
MAX_LOGS;
Expand Down Expand Up @@ -247,6 +245,10 @@ void response (char const *const fmt_, ...)

void addLog (LogLevel const level_, char const *const fmt_, va_list ap_)
{
#ifdef __WIIU__
// the plugin is currently never calling drawLogs
return;
#endif
#ifdef NDEBUG
if (level_ == DEBUGLOG)
return;
Expand Down Expand Up @@ -277,6 +279,10 @@ void addLog (LogLevel const level_, char const *const fmt_, va_list ap_)

void addLog (LogLevel const level_, std::string_view const message_)
{
#ifdef __WIIU__
// the plugin is currently never calling drawLogs
return;
#endif
#ifdef NDEBUG
if (level_ == DEBUGLOG)
return;
Expand Down
7 changes: 6 additions & 1 deletion source/socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.

#include "socket.h"

#include "log.h"
#include "platform.h"

#include <chrono>
#include <fcntl.h>
#include <sys/socket.h>
#include <unistd.h>
Expand All @@ -31,6 +32,8 @@
#include <cstdio>
#include <cstring>

using namespace std::chrono_literals;

///////////////////////////////////////////////////////////////////////////
Socket::~Socket ()
{
Expand Down Expand Up @@ -100,6 +103,7 @@ bool Socket::bind (SockAddr const &addr_)
case AF_INET:
if (::bind (m_fd, addr_, sizeof (struct sockaddr_in)) != 0)
{
platform::Thread::sleep (5000ms);
error ("bind: %s\n", std::strerror (errno));
return false;
}
Expand All @@ -110,6 +114,7 @@ bool Socket::bind (SockAddr const &addr_)
if (::bind (m_fd, addr_, sizeof (struct sockaddr_in6)) != 0)
{
error ("bind: %s\n", std::strerror (errno));
platform::Thread::sleep (5000ms);
return false;
}
break;
Expand Down
2 changes: 1 addition & 1 deletion source/wiiu/platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#ifndef CLASSIC
#error "Wii U must be built in classic mode"
#endif
#define VERSION "v0.4.2"
#define VERSION "v0.4.3"
#define VERSION_FULL VERSION VERSION_EXTRA

WUPS_PLUGIN_NAME ("ftpiiu");
Expand Down