mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-23 03:06:52 -04:00
htcs: fixes, echo server is now fully functional
This commit is contained in:
parent
72de4d85f3
commit
0ec54ed492
8 changed files with 33 additions and 19 deletions
|
@ -15,8 +15,13 @@
|
|||
*/
|
||||
#include <stratosphere.hpp>
|
||||
#include "htcs_session.hpp"
|
||||
|
||||
extern "C" {
|
||||
|
||||
#include <switch/services/htcs.h>
|
||||
|
||||
}
|
||||
|
||||
namespace ams::htcs::client {
|
||||
|
||||
namespace {
|
||||
|
@ -32,6 +37,10 @@ namespace ams::htcs::client {
|
|||
}
|
||||
} g_static_allocator_initializer;
|
||||
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
class RemoteSocket {
|
||||
private:
|
||||
::HtcsSocket m_s;
|
||||
|
@ -112,6 +121,8 @@ namespace ams::htcs::client {
|
|||
::HtcsSocket libnx_socket;
|
||||
R_TRY(::htcsCreateSocket(out_err.GetPointer(), std::addressof(libnx_socket), enable_disconnection_emulation));
|
||||
|
||||
R_SUCCEED_IF(*out_err != 0);
|
||||
|
||||
*out = ObjectFactory::CreateSharedEmplaced<tma::ISocket, RemoteSocket>(libnx_socket);
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
@ -160,7 +171,6 @@ namespace ams::htcs::client {
|
|||
return ::htcsSocketFcntl(std::addressof(m_s), out_err.GetPointer(), out_res.GetPointer(), command, value);
|
||||
}
|
||||
|
||||
|
||||
Result RemoteSocket::AcceptStart(sf::Out<u32> out_task_id, sf::OutCopyHandle out_event) {
|
||||
return ::htcsSocketAcceptStart(std::addressof(m_s), out_task_id.GetPointer(), out_event.GetHandlePointer());
|
||||
}
|
||||
|
@ -170,6 +180,8 @@ namespace ams::htcs::client {
|
|||
::HtcsSocket libnx_socket;
|
||||
R_TRY(::htcsSocketAcceptResults(std::addressof(m_s), out_err.GetPointer(), std::addressof(libnx_socket), reinterpret_cast<::SockAddrHtcs *>(out_address.GetPointer()), task_id));
|
||||
|
||||
R_SUCCEED_IF(*out_err != 0);
|
||||
|
||||
*out = ObjectFactory::CreateSharedEmplaced<tma::ISocket, RemoteSocket>(libnx_socket);
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue