2018-05-29 21:54:27 +02:00
|
|
|
/*******************************************************************************
|
|
|
|
* libretroshare/src/services: p3heartbeat.h *
|
|
|
|
* *
|
|
|
|
* libretroshare: retroshare core library *
|
|
|
|
* *
|
|
|
|
* Copyright 2004-2013 Robert Fernie <retroshare@lunamutt.com> *
|
|
|
|
* *
|
|
|
|
* This program is free software: you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU Lesser General Public License as *
|
|
|
|
* published by the Free Software Foundation, either version 3 of the *
|
|
|
|
* License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU Lesser General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License *
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
|
|
|
* *
|
|
|
|
*******************************************************************************/
|
2013-09-28 08:09:59 +00:00
|
|
|
#ifndef MRK_SERVICES_HEARTBEAT_H
|
|
|
|
#define MRK_SERVICES_HEARTBEAT_H
|
|
|
|
|
|
|
|
// Moved Heartbeat to a seperate service.
|
|
|
|
|
|
|
|
#include "services/p3service.h"
|
|
|
|
|
2014-03-29 03:57:44 +00:00
|
|
|
class p3ServiceControl;
|
|
|
|
class pqipersongrp;
|
2013-09-28 08:09:59 +00:00
|
|
|
|
|
|
|
class p3heartbeat: public p3Service
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2014-03-29 03:57:44 +00:00
|
|
|
p3heartbeat(p3ServiceControl *sc, pqipersongrp *pqipg);
|
2013-09-28 08:09:59 +00:00
|
|
|
virtual ~p3heartbeat();
|
|
|
|
|
2014-03-22 03:53:44 +00:00
|
|
|
virtual RsServiceInfo getServiceInfo();
|
|
|
|
|
2013-09-28 08:09:59 +00:00
|
|
|
int tick();
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
2014-03-17 20:56:06 +00:00
|
|
|
void sendHeartbeat(const RsPeerId &toId);
|
|
|
|
void recvHeartbeat(const RsPeerId &fromId);
|
2013-09-28 08:09:59 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2014-03-29 03:57:44 +00:00
|
|
|
p3ServiceControl *mServiceCtrl;
|
2013-09-28 08:09:59 +00:00
|
|
|
pqipersongrp *mPqiPersonGrp;
|
|
|
|
|
|
|
|
/* data */
|
|
|
|
RsMutex mHeartMtx;
|
|
|
|
|
2018-10-07 01:34:05 +02:00
|
|
|
rstime_t mLastHeartbeat;
|
2013-09-28 08:09:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MRK_SERVICES_HEARTBEAT_H
|