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)