From d92b3e9754f635ed956fa11a769f29dab704a388 Mon Sep 17 00:00:00 2001 From: Hamish Milne Date: Sat, 28 Mar 2020 16:29:15 +0000 Subject: [PATCH] Code review changes - clarified HTTP serialization --- src/core/hle/service/http_c.h | 27 +++++++++------------------ src/core/hle/service/mic_u.cpp | 2 ++ src/video_core/primitive_assembly.h | 4 +--- 3 files changed, 12 insertions(+), 21 deletions(-) diff --git a/src/core/hle/service/http_c.h b/src/core/hle/service/http_c.h index d94b47a45e..490e066481 100644 --- a/src/core/hle/service/http_c.h +++ b/src/core/hle/service/http_c.h @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -215,24 +216,6 @@ public: #ifdef ENABLE_WEB_SERVICE httplib::Response response; #endif - -private: - template - void serialize(Archive& ar, const unsigned int) { - ar& handle; - ar& session_id; - ar& url; - ar& method; - ar& state; - ar& proxy; - ar& basic_auth; - ar& ssl_config; - ar& socket_buffer_size; - ar& headers; - ar& post_data; - } - friend class boost::serialization::access; - }; struct SessionData : public Kernel::SessionRequestHandler::SessionDataBase { @@ -453,10 +436,18 @@ private: private: template void serialize(Archive& ar, const unsigned int) { + // NOTE: Serialization of the HTTP service is on a 'best effort' basis. + // There is a very good chance that saving/loading during a network connection will break, + // regardless! ar& boost::serialization::base_object(*this); ar& ClCertA.certificate; ar& ClCertA.private_key; ar& ClCertA.init; + ar& context_counter; + ar& client_certs_counter; + ar& client_certs; + // NOTE: `contexts` is not serialized because it contains non-serializable data. (i.e. + // handles to ongoing HTTP requests.) Serializing across HTTP contexts will break. } friend class boost::serialization::access; }; diff --git a/src/core/hle/service/mic_u.cpp b/src/core/hle/service/mic_u.cpp index bd324ada25..08ef5473f4 100644 --- a/src/core/hle/service/mic_u.cpp +++ b/src/core/hle/service/mic_u.cpp @@ -110,6 +110,7 @@ struct State { private: template void serialize(Archive& ar, const unsigned int) { + ar& memory_ref; ar& sharedmem_size; ar& size; ar& offset; @@ -139,6 +140,7 @@ struct MIC_U::Impl { if (shared_memory) { shared_memory->SetName("MIC_U:shared_memory"); + state.memory_ref = shared_memory; state.sharedmem_buffer = shared_memory->GetPointer(); state.sharedmem_size = size; } diff --git a/src/video_core/primitive_assembly.h b/src/video_core/primitive_assembly.h index d6547dddd4..404bc5316c 100644 --- a/src/video_core/primitive_assembly.h +++ b/src/video_core/primitive_assembly.h @@ -5,10 +5,8 @@ #pragma once #include +#include #include "video_core/regs_pipeline.h" -namespace boost::serialization { -class access; -} namespace Pica {