mirror of
https://github.com/Lime3DS/Lime3DS
synced 2024-12-27 01:22:37 -06:00
Services/HTTP: Stubbed the CloseContext service function.
It is currently unknown how the real http module handles trying to close contexts for requests that are already in flight.
This commit is contained in:
parent
34baa882c8
commit
799b45233f
2 changed files with 34 additions and 1 deletions
|
@ -164,11 +164,35 @@ void HTTP_C::CreateContext(Kernel::HLERequestContext& ctx) {
|
|||
rb.PushMappedBuffer(buffer);
|
||||
}
|
||||
|
||||
void HTTP_C::CloseContext(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx, 0x3, 2, 0);
|
||||
|
||||
u32 context_handle = rp.Pop<u32>();
|
||||
|
||||
LOG_WARNING(Service_HTTP, "(STUBBED) called, handle={}", context_handle);
|
||||
|
||||
auto itr = contexts.find(context_handle);
|
||||
if (itr == contexts.end()) {
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(ERROR_CONTEXT_ERROR);
|
||||
LOG_ERROR(Service_HTTP, "called, context {} not found", context_handle);
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO(Subv): What happens if you try to close a context that's currently being used?
|
||||
ASSERT(itr->second.state == RequestState::NotStarted);
|
||||
|
||||
contexts.erase(itr);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
}
|
||||
|
||||
HTTP_C::HTTP_C() : ServiceFramework("http:C", 32) {
|
||||
static const FunctionInfo functions[] = {
|
||||
{0x00010044, &HTTP_C::Initialize, "Initialize"},
|
||||
{0x00020082, &HTTP_C::CreateContext, "CreateContext"},
|
||||
{0x00030040, nullptr, "CloseContext"},
|
||||
{0x00030040, &HTTP_C::CloseContext, "CloseContext"},
|
||||
{0x00040040, nullptr, "CancelConnection"},
|
||||
{0x00050040, nullptr, "GetRequestState"},
|
||||
{0x00060040, nullptr, "GetDownloadSizeState"},
|
||||
|
|
|
@ -45,6 +45,15 @@ private:
|
|||
*/
|
||||
void CreateContext(Kernel::HLERequestContext& ctx);
|
||||
|
||||
/**
|
||||
* HTTP_C::CreateContext service function
|
||||
* Inputs:
|
||||
* 1 : Context handle
|
||||
* Outputs:
|
||||
* 1 : Result of function, 0 on success, otherwise error code
|
||||
*/
|
||||
void CloseContext(Kernel::HLERequestContext& ctx);
|
||||
|
||||
Kernel::SharedPtr<Kernel::SharedMemory> shared_memory = nullptr;
|
||||
|
||||
std::unordered_map<u32, Context> contexts;
|
||||
|
|
Loading…
Reference in a new issue