Skip to content

Commit

Permalink
[XrdCl] Support undocumented wait response of zero size
Browse files Browse the repository at this point in the history
  • Loading branch information
ljanyst committed Apr 22, 2013
1 parent 7c8a8d2 commit 5376f91
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions src/XrdCl/XrdClXRootDMsgHandler.cc
Expand Up @@ -426,15 +426,26 @@ namespace XrdCl
{
std::auto_ptr<Message> msgPtr( pResponse );
pResponse = 0;
uint32_t waitSeconds = 0;

char *infoMsg = new char[rsp->hdr.dlen-3];
infoMsg[rsp->hdr.dlen-4] = 0;
memcpy( infoMsg, rsp->body.wait.infomsg, rsp->hdr.dlen-4 );
log->Dump( XRootDMsg, "[%s] Got kXR_wait response of %d seconds to "
"message %s: %s", pUrl.GetHostId().c_str(),
rsp->body.wait.seconds, pRequest->GetDescription().c_str(),
infoMsg );
delete [] infoMsg;
if( rsp->hdr.dlen >= 4 )
{
char *infoMsg = new char[rsp->hdr.dlen-3];
infoMsg[rsp->hdr.dlen-4] = 0;
memcpy( infoMsg, rsp->body.wait.infomsg, rsp->hdr.dlen-4 );
log->Dump( XRootDMsg, "[%s] Got kXR_wait response of %d seconds to "
"message %s: %s", pUrl.GetHostId().c_str(),
rsp->body.wait.seconds, pRequest->GetDescription().c_str(),
infoMsg );
delete [] infoMsg;
waitSeconds = rsp->body.wait.seconds;
}
else
{
log->Dump( XRootDMsg, "[%s] Got kXR_wait response of 0 seconds to "
"message %s", pUrl.GetHostId().c_str(),
pRequest->GetDescription().c_str() );
}

//----------------------------------------------------------------------
// Some messages require rewriting before they can be sent again
Expand All @@ -453,7 +464,7 @@ namespace XrdCl
//----------------------------------------------------------------------
TaskManager *taskMgr = pPostMaster->GetTaskManager();
taskMgr->RegisterTask( new WaitTask( this ),
::time(0)+rsp->body.wait.seconds );
::time(0)+waitSeconds );
return;
}

Expand Down

0 comments on commit 5376f91

Please sign in to comment.