adamdebreceni commented on code in PR #1826:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1826#discussion_r1842184728


##########
extensions/civetweb/processors/ListenHTTP.h:
##########
@@ -141,18 +147,39 @@ class ListenHTTP : public core::Processor {
   void onSchedule(core::ProcessContext& context, core::ProcessSessionFactory& 
session_factory) override;
   std::string getPort() const;
   bool isSecure() const;
+  void restore(const std::shared_ptr<core::FlowFile>& flowFile) override;
+
+  bool isWorkAvailable() override {
+    return handler_ ? !handler_->empty() : false;
+  }
+
+  std::set<core::Connectable*> getOutGoingConnections(const std::string 
&relationship) override;
 
   struct ResponseBody {
     std::string uri;
     std::string mime_type;
-    std::vector<std::byte> body;
+    std::shared_ptr<core::FlowFile> flow_file;
   };
 
   // HTTP request handler
   class Handler : public CivetHandler {
    public:
+    enum class FailureReason {
+      PROCESSOR_SHUTDOWN
+    };
+    struct RequestValue {
+      std::reference_wrapper<core::ProcessSession> session;
+      std::promise<void> ret;
+    };
+    struct FailureValue {
+      FailureReason reason;
+      std::promise<void> ret;
+    };
+    using Request = std::promise<nonstd::expected<RequestValue, FailureValue>>;

Review Comment:
   the processor should release all references to the ProcessSession before 
returning from onTrigger, and since writing the data into the flowfile happens 
on the Handler's thread, it is not enough for the Handler to wait for the 
onTrigger's resources (promise1) onTrigger should also wait for the Handler's 
thread to release these resources (promise2)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to