You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mesos.apache.org by "Anand Mazumdar (JIRA)" <ji...@apache.org> on 2016/07/13 23:00:24 UTC
[jira] [Created] (MESOS-5843) Make `HttpConnection` in Master/Agent
as a RAII object.
Anand Mazumdar created MESOS-5843:
-------------------------------------
Summary: Make `HttpConnection` in Master/Agent as a RAII object.
Key: MESOS-5843
URL: https://issues.apache.org/jira/browse/MESOS-5843
Project: Mesos
Issue Type: Improvement
Reporter: Anand Mazumdar
Priority: Minor
Currently, {{HttpConnection}} in {{Master}}/{{Agent}} is not a RAII object. It's pretty non-intuitive to a reader that the object is copied over by the {{Framework}}/{{Subscriber}} struct but the caller can still call {{close()}} on the object.
{code}
HttpConnection http {pipe.writer(), contentType, UUID::random()};
Framework framework{http};
http.close(); // Yikes!
{code}
One solution to this can be to have {{HttpConnection}} maintain a {{Data}} struct inside it that is ref counted and {{close()}} the {{Pipe}} upon destruction. Also, the {{Pipe}} can be created inside the {{HttpConnection}} itself rather then passing it onto it. {{HttpConnection}} can just expose a getter function for {{Pipe::Reader}} that we can pass over to the {{OK}} response object.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)