Skip to content

Commit

Permalink
fix compiler error
Browse files Browse the repository at this point in the history
  • Loading branch information
spacemeowx2 committed Apr 17, 2020
1 parent 70e2b8c commit 5f68d91
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 22 deletions.
14 changes: 7 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
FROM devkitpro/devkita64_devkitarm:20190720
FROM devkitpro/devkita64_devkitarm:20200405

# RUN git clone -b master https://github.com/switchbrew/libnx.git --depth=1 \
# && cd libnx \
# && make -j8 \
# && make install \
# && cd .. \
# && rm -rf libnx
RUN dkp-pacman -Syyu --noconfirm switch-dev libnx \
&& dkp-pacman -Scc --noconfirm
RUN git clone -b master https://github.com/switchbrew/libnx.git --depth=1 \
&& cd libnx \
&& make -j8 \
&& make install \
&& cd .. \
&& rm -rf libnx

VOLUME [ "/code" ]
WORKDIR /code
Expand Down
4 changes: 2 additions & 2 deletions ldn_mitm/source/ipinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Result _nifmSetConnectionConfirmationOption(s8 option);
Result _nifmSubmitRequest();

Result ipinfoInit() {
atomicIncrement64(&g_nifmRefCount);
g_nifmRefCount++;
if (serviceIsActive(&g_nifmSrv))
return 0;

Expand All @@ -39,7 +39,7 @@ Result ipinfoInit() {
}

void ipinfoExit() {
if (atomicDecrement64(&g_nifmRefCount) == 0) {
if (--g_nifmRefCount == 0) {
serviceClose(&g_nifmIReq);
serviceClose(&g_nifmIGS);
serviceClose(&g_nifmSrv);
Expand Down
13 changes: 3 additions & 10 deletions ldn_mitm/source/lan_discovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -704,10 +704,7 @@ namespace ams::mitm::ldn {

if (this->inited) {
this->stop = true;
rc = this->workerThread.Join();
if (R_FAILED(rc)) {
LogFormat("thread.join %d", rc);
}
os::WaitThread(&this->workerThread);
this->udp.reset();
this->tcp.reset();
this->resetStations();
Expand Down Expand Up @@ -751,17 +748,13 @@ namespace ams::mitm::ldn {
return rc;
}

rc = this->workerThread.Initialize(&Worker, this, 0x4000, 0x15, 2);
rc = os::CreateThread(&this->workerThread, &Worker, this, stack.get(), StackSize, 0x15, 2);
if (R_FAILED(rc)) {
LogFormat("LANDiscovery Failed to threadCreate: %x", rc);
return 0xF601;
}

rc = this->workerThread.Start();
if (R_FAILED(rc)) {
LogFormat("LANDiscovery Failed to threadStart %x", rc);
return 0xF601;
}
os::StartThread(&this->workerThread);
this->setState(CommState::Initialized);

this->inited = true;
Expand Down
5 changes: 4 additions & 1 deletion ldn_mitm/source/lan_discovery.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "lan_protocol.hpp"

namespace ams::mitm::ldn {
const size_t StackSize = 0x4000;
enum class NodeStatus : u8 {
Disconnected,
Connect,
Expand Down Expand Up @@ -137,7 +138,7 @@ namespace ams::mitm::ldn {
bool inited;
NetworkInfo networkInfo;
u16 listenPort;
os::Thread workerThread;
os::ThreadType workerThread;
CommState state;
void worker();
int loopPoll();
Expand All @@ -151,6 +152,7 @@ namespace ams::mitm::ldn {
Result getFakeMac(MacAddress *mac);
Result getNodeInfo(NodeInfo *node, const UserConfig *userConfig, u16 localCommunicationVersion);
LanEventFunc lanEvent;
std::unique_ptr<u8[StackSize]> stack;
public:
Result initialize(LanEventFunc lanEvent = EmptyFunc, bool listening = true);
Result finalize();
Expand All @@ -170,6 +172,7 @@ namespace ams::mitm::ldn {
public:
LANDiscovery(u16 port = DefaultPort) :
disconnect_reason(DisconnectReason::None),
pollMutex(false),
stations({{{1, this}, {2, this}, {3, this}, {4, this}, {5, this}, {6, this}, {7, this}}}),
stop(false), inited(false),
networkInfo({}), listenPort(port),
Expand Down
4 changes: 2 additions & 2 deletions ldn_mitm/source/ldn_icommunication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ namespace ams::mitm::ldn {
LogFormat("ICommunicationInterface::Initialize pid: %" PRIu64, client_process_id);

if (this->state_event == nullptr) {
this->state_event = new os::SystemEvent(true);
// ClearMode, inter_process
this->state_event = new os::SystemEvent(ams::os::EventClearMode_AutoClear, true);
}

R_TRY(lanDiscovery.initialize([&](){
Expand All @@ -30,7 +31,6 @@ namespace ams::mitm::ldn {
Result ICommunicationInterface::Finalize() {
Result rc = lanDiscovery.finalize();
if (this->state_event) {
this->state_event->Finalize();
delete this->state_event;
this->state_event = nullptr;
}
Expand Down

0 comments on commit 5f68d91

Please sign in to comment.