2018-10-04 18:12:53 +02:00
|
|
|
// This file is under GNU General Public License 3.0
|
|
|
|
// see LICENSE.txt
|
|
|
|
|
2020-08-12 18:20:25 +02:00
|
|
|
#include "framework.hh"
|
2018-10-04 18:05:51 +02:00
|
|
|
#include <iostream>
|
|
|
|
#include <assert.h>
|
|
|
|
#include <unistd.h>
|
2020-08-05 17:57:10 +02:00
|
|
|
#include <sys/param.h>
|
2018-10-04 18:34:00 +02:00
|
|
|
#include <pEp/keymanagement.h>
|
2020-04-23 00:53:19 +02:00
|
|
|
#include "pEpLog.hh"
|
2018-10-04 18:05:51 +02:00
|
|
|
|
|
|
|
using namespace std;
|
2018-10-05 08:46:40 +02:00
|
|
|
using namespace pEp::Adapter;
|
2018-10-04 18:05:51 +02:00
|
|
|
|
|
|
|
PEP_STATUS messageToSend(struct _message *msg)
|
|
|
|
{
|
2020-04-22 16:06:11 +02:00
|
|
|
pEpLog("called()");
|
2018-10-04 18:05:51 +02:00
|
|
|
return PEP_STATUS_OK;
|
|
|
|
}
|
|
|
|
|
2018-12-17 09:13:55 +01:00
|
|
|
PEP_STATUS notifyHandshake(pEp_identity *me, pEp_identity *partner, sync_handshake_signal signal)
|
2018-10-04 18:05:51 +02:00
|
|
|
{
|
2020-04-22 16:06:11 +02:00
|
|
|
pEpLog("called()");
|
2018-10-04 18:05:51 +02:00
|
|
|
return PEP_STATUS_OK;
|
|
|
|
}
|
|
|
|
|
2020-08-12 19:52:57 +02:00
|
|
|
int main(int argc, char **argv)
|
2018-10-04 18:05:51 +02:00
|
|
|
{
|
2020-08-12 19:52:57 +02:00
|
|
|
pEp::Test::setup(argc, argv);
|
2020-08-05 17:57:10 +02:00
|
|
|
|
2020-01-10 15:09:44 +01:00
|
|
|
// Create new identity
|
2020-01-10 13:39:28 +01:00
|
|
|
pEpLog("updating or creating identity for me");
|
2018-10-04 18:34:00 +02:00
|
|
|
pEp_identity *me = new_identity("alice@peptest.ch", NULL, "23", "Who the F* is Alice");
|
|
|
|
assert(me);
|
2018-10-05 08:46:40 +02:00
|
|
|
PEP_STATUS status = myself(session(), me);
|
|
|
|
free_identity(me);
|
2018-10-05 08:49:22 +02:00
|
|
|
pEp::throw_status(status);
|
2018-10-04 18:34:00 +02:00
|
|
|
|
2020-01-10 15:09:44 +01:00
|
|
|
// start and stop sync repeatedly
|
2020-04-22 16:06:11 +02:00
|
|
|
useconds_t sleepuSec = 1000 * 100;
|
|
|
|
unsigned long long int nrIters = 1000 * 1000 * 1000;
|
2020-01-10 15:09:44 +01:00
|
|
|
for (int i = 0; i < nrIters; i++) {
|
2020-04-22 16:06:11 +02:00
|
|
|
pEpLog("RUN NR: ");
|
|
|
|
pEpLog(i);
|
2020-01-10 15:09:44 +01:00
|
|
|
pEpLog("SYNC START");
|
2020-04-22 16:06:11 +02:00
|
|
|
pEpLog("starting the adapter including sync");
|
2020-01-10 15:09:44 +01:00
|
|
|
startup(messageToSend, notifyHandshake);
|
|
|
|
pEpLog("SYNC STOP");
|
|
|
|
usleep(sleepuSec);
|
|
|
|
shutdown();
|
|
|
|
}
|
2018-10-04 18:05:51 +02:00
|
|
|
return 0;
|
|
|
|
}
|