Commit 9e6fb67f authored by Michael Davis's avatar Michael Davis
Browse files

[XrdSsi] Fixes Metadata corruption bug

parent 609ad53c
...@@ -140,9 +140,6 @@ bool XrdSsiPbRequest<RequestType, ResponseType, MetadataType, AlertType>::Proces ...@@ -140,9 +140,6 @@ bool XrdSsiPbRequest<RequestType, ResponseType, MetadataType, AlertType>::Proces
if(metadata_len > 0) if(metadata_len > 0)
{ {
// Temporary workaround for XrdSsi bug #537:
++metadata_buffer; --metadata_len;
// Deserialize the metadata // Deserialize the metadata
const std::string metadata_str(metadata_buffer, metadata_len); const std::string metadata_str(metadata_buffer, metadata_len);
......
...@@ -31,7 +31,6 @@ public: ...@@ -31,7 +31,6 @@ public:
private: private:
void Alert(const AlertType &alert) void Alert(const AlertType &alert)
{ {
// Encapsulate the Alert protocol buffer inside a XrdSsiRespInfoMsg object. Alert message objects // Encapsulate the Alert protocol buffer inside a XrdSsiRespInfoMsg object. Alert message objects
...@@ -50,6 +49,11 @@ private: ...@@ -50,6 +49,11 @@ private:
ResponseType m_response; ResponseType m_response;
AlertType m_alert; AlertType m_alert;
MetadataType m_metadata; MetadataType m_metadata;
// Metadata and response buffers must stay in scope until Finished() is called, so they need to be member variables
std::string m_response_str;
std::string m_metadata_str;
}; };
...@@ -95,35 +99,30 @@ void RequestProc<RequestType, ResponseType, MetadataType, AlertType>::Execute() ...@@ -95,35 +99,30 @@ void RequestProc<RequestType, ResponseType, MetadataType, AlertType>::Execute()
// Serialize the Metadata // Serialize the Metadata
std::string response_str; if(!m_metadata.SerializeToString(&m_metadata_str))
if(!m_metadata.SerializeToString(&response_str))
{ {
throw XrdSsiException("metadata.SerializeToString() failed"); throw XrdSsiException("m_metadata.SerializeToString() failed");
} }
// Send the Metadata // Send the Metadata
if(response_str.size() > 0) if(m_metadata_str.size() > 0)
{ {
// Temporary workaround for XrdSsi bug #537: SetMetadata(m_metadata_str.c_str(), m_metadata_str.size());
response_str = " " + response_str;
SetMetadata(response_str.c_str(), response_str.size());
} }
// Serialize the Response // Serialize the Response
if(!m_response.SerializeToString(&response_str)) if(!m_response.SerializeToString(&m_response_str))
{ {
throw XrdSsiException("response.SerializeToString() failed"); throw XrdSsiException("m_response.SerializeToString() failed");
} }
// Send the response // Send the response
if(response_str.size() > 0) if(m_response_str.size() > 0)
{ {
SetResponse(response_str.c_str(), response_str.size()); SetResponse(m_response_str.c_str(), m_response_str.size());
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment