Skip to content
Snippets Groups Projects
Commit ae3a0a79 authored by Michael Davis's avatar Michael Davis
Browse files

Fixes XrdSsi receive metadata

parent 54dd8cad
No related branches found
No related tags found
No related merge requests found
......@@ -10,14 +10,6 @@ bool TestSsiRequest::ProcessResponse(const XrdSsiErrInfo &eInfo, const XrdSsiRes
cerr << "ProcessResponse() callback called with response type = " << rInfo.State() << endl;
// Resume handling callbacks if they were on hold
if(!queue_on_hold)
{
cerr << "resuming...";
this->RestartDataResponse(XrdSsiRequest::RDR_All);
}
if (eInfo.hasError())
{
// Handle error using the passed eInfo object
......@@ -42,19 +34,22 @@ bool TestSsiRequest::ProcessResponse(const XrdSsiErrInfo &eInfo, const XrdSsiRes
GetMetadata(myMetadataLen);
if(rInfo.rType == XrdSsiRespInfo::isData && myMetadataLen == 0)
if(rInfo.rType == XrdSsiRespInfo::isData && myMetadataLen > 0)
{
cerr << "Response is metadata only." << endl;
cerr << "Response has " << myMetadataLen << " bytes of metadata." << endl;
// do something with metadata
#if 0
// clean up
Finished();
delete this;
#endif
}
else if(rInfo.rType == XrdSsiRespInfo::isHandle)
if(rInfo.rType == XrdSsiRespInfo::isHandle)
{
cerr << "Response is detached, handle = " << endl;
......@@ -66,7 +61,8 @@ bool TestSsiRequest::ProcessResponse(const XrdSsiErrInfo &eInfo, const XrdSsiRes
delete this;
}
else
if(rInfo.rType == XrdSsiRespInfo::isData)
{
// A proper data response type
......@@ -85,16 +81,7 @@ XrdSsiRequest::PRD_Xeq TestSsiRequest::ProcessResponseData(const XrdSsiErrInfo &
{
using namespace std;
// Simulate the scenario where we can't handle the queue at this time
queue_on_hold = false;
if(queue_on_hold)
{
cerr << "Response queue is on hold...";
queue_on_hold = false;
return XrdSsiRequest::PRD_Hold;
}
// If we can't handle the queue at this time, return XrdSsiRequest::PRD_Hold;
// GetResponseData() above places the data in the allocated buffer, then calls this method with
// the buffer type and length
......
......@@ -7,6 +7,16 @@ class TestSsiRequest : public XrdSsiRequest
{
public:
TestSsiRequest(const std::string &buffer_str, uint16_t tmo=0) : request_buffer(buffer_str.c_str()), request_len(buffer_str.length())
{
std::cerr << "Creating TestSsiRequest object, setting tmo=" << tmo << std::endl;
this->SetTimeOut(tmo);
}
virtual ~TestSsiRequest()
{
std::cerr << "Deleting TestSsiRequest object" << std::endl;
}
// It is up to the implementation to create request data, save it in some manner, and provide it to
// the framework when GetRequest() is called. Optionally define the RelRequestBuffer() method to
// clean up when the framework no longer needs access to the data.
......@@ -15,7 +25,7 @@ public:
// Query for Andy: shouldn't the return type for GetRequest be const?
virtual char *GetRequest(int &dlen) override {dlen = reqBLen; return const_cast<char*>(reqBuff);}
virtual char *GetRequest(int &reqlen) override { reqlen = request_len; return const_cast<char*>(request_buffer); }
// Requests are sent to the server asynchronously via the service object. The ProcessResponse() callback
// is used to inform the request object if the request completed or failed.
......@@ -33,23 +43,10 @@ public:
virtual void Alert(XrdSsiRespInfoMsg &aMsg) override;
// Constructor/Destructor
TestSsiRequest(const std::string &buffer_str, uint16_t tmo=0) : reqBuff(buffer_str.c_str()), reqBLen(buffer_str.length()), queue_on_hold(true)
{
std::cerr << "Creating TestSsiRequest object, setting tmo=" << tmo << std::endl;
this->SetTimeOut(tmo);
}
virtual ~TestSsiRequest()
{
std::cerr << "Deleting TestSsiRequest object" << std::endl;
}
private:
const char *reqBuff;
int reqBLen;
bool queue_on_hold;
const char *request_buffer;
int request_len;
};
#endif
......@@ -30,6 +30,7 @@ void RequestProc<xrdssi::test::Request, xrdssi::test::Result>::ExecuteAction()
template <>
void RequestProc<xrdssi::test::Request, xrdssi::test::Result>::ExecuteMetadata()
{
std::cerr << "Sending metadata..." << std::endl;
const std::string metadata("Have some metadata!");
SetMetadata(metadata.c_str(), metadata.size());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment