Skip to content

Commit

Permalink
[XrdCl] Make the AsyncSocketHandler remember time of last activity
Browse files Browse the repository at this point in the history
  • Loading branch information
ljanyst committed Jan 24, 2014
1 parent df4eaff commit ec36aa4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/XrdCl/XrdClAsyncSocketHandler.cc
Expand Up @@ -58,6 +58,7 @@ namespace XrdCl

pSocket = new Socket();
pIncHandler = std::make_pair( (IncomingMsgHandler*)0, false );
pLastActivity = time(0);
}

//----------------------------------------------------------------------------
Expand All @@ -75,7 +76,7 @@ namespace XrdCl
Status AsyncSocketHandler::Connect( time_t timeout )
{
Log *log = DefaultEnv::GetLog();
pConnectionStarted = ::time(0);
pLastActivity = pConnectionStarted = ::time(0);
pConnectionTimeout = timeout;

//--------------------------------------------------------------------------
Expand Down Expand Up @@ -166,6 +167,8 @@ namespace XrdCl
//----------------------------------------------------------------------------
void AsyncSocketHandler::Event( uint8_t type, XrdCl::Socket */*socket*/ )
{
pLastActivity = time(0);

//--------------------------------------------------------------------------
// Read event
//--------------------------------------------------------------------------
Expand Down
9 changes: 9 additions & 0 deletions src/XrdCl/XrdClAsyncSocketHandler.hh
Expand Up @@ -124,6 +124,14 @@ namespace XrdCl
pSocketDomain = domain;
}

//------------------------------------------------------------------------
//! Get timestamp of last registered socket activity
//------------------------------------------------------------------------
time_t GetLastActivity()
{
return pLastActivity;
}

private:

//------------------------------------------------------------------------
Expand Down Expand Up @@ -211,6 +219,7 @@ namespace XrdCl
uint32_t pIncMsgSize;
uint32_t pOutMsgSize;
int pSocketDomain;
time_t pLastActivity;
};
}

Expand Down

0 comments on commit ec36aa4

Please sign in to comment.