Merge branch 'master' into ar
This commit is contained in:
commit
ccc4034084
@ -26,7 +26,9 @@
|
|||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
|
#ifdef __linux__
|
||||||
#include <sys/eventfd.h>
|
#include <sys/eventfd.h>
|
||||||
|
#endif
|
||||||
#include "taler_fakebank_lib.h"
|
#include "taler_fakebank_lib.h"
|
||||||
#include "taler_bank_service.h"
|
#include "taler_bank_service.h"
|
||||||
#include "taler_mhd_lib.h"
|
#include "taler_mhd_lib.h"
|
||||||
@ -414,11 +416,25 @@ struct TALER_FAKEBANK_Handle
|
|||||||
*/
|
*/
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
/**
|
/**
|
||||||
* Event FD to signal @a lp_thread a change in
|
* Event FD to signal @a lp_thread a change in
|
||||||
* @a lp_heap.
|
* @a lp_heap.
|
||||||
*/
|
*/
|
||||||
int lp_event;
|
int lp_event;
|
||||||
|
#else
|
||||||
|
/**
|
||||||
|
* Pipe input to signal @a lp_thread a change in
|
||||||
|
* @a lp_heap.
|
||||||
|
*/
|
||||||
|
int lp_event_in;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pipe output to signal @a lp_thread a change in
|
||||||
|
* @a lp_heap.
|
||||||
|
*/
|
||||||
|
int lp_event_out;
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set to true once we are shutting down.
|
* Set to true once we are shutting down.
|
||||||
@ -480,7 +496,11 @@ lp_trigger (struct LongPoller *lp,
|
|||||||
MHD_resume_connection (lp->conn);
|
MHD_resume_connection (lp->conn);
|
||||||
GNUNET_free (lp);
|
GNUNET_free (lp);
|
||||||
h->mhd_again = true;
|
h->mhd_again = true;
|
||||||
|
#ifdef __linux__
|
||||||
if (-1 != h->lp_event)
|
if (-1 != h->lp_event)
|
||||||
|
#else
|
||||||
|
if (-1 != h->lp_event_in && -1 != h->lp_event_out)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (NULL != h->mhd_task)
|
if (NULL != h->mhd_task)
|
||||||
GNUNET_SCHEDULER_cancel (h->mhd_task);
|
GNUNET_SCHEDULER_cancel (h->mhd_task);
|
||||||
@ -541,7 +561,11 @@ lp_expiration_thread (void *cls)
|
|||||||
pthread_mutex_unlock (&h->big_lock));
|
pthread_mutex_unlock (&h->big_lock));
|
||||||
{
|
{
|
||||||
struct pollfd p = {
|
struct pollfd p = {
|
||||||
|
#ifdef __linux__
|
||||||
.fd = h->lp_event,
|
.fd = h->lp_event,
|
||||||
|
#else
|
||||||
|
.fd = h->lp_event_out,
|
||||||
|
#endif
|
||||||
.events = POLLIN
|
.events = POLLIN
|
||||||
};
|
};
|
||||||
int ret;
|
int ret;
|
||||||
@ -561,7 +585,11 @@ lp_expiration_thread (void *cls)
|
|||||||
uint64_t ev;
|
uint64_t ev;
|
||||||
ssize_t iret;
|
ssize_t iret;
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
iret = read (h->lp_event,
|
iret = read (h->lp_event,
|
||||||
|
#else
|
||||||
|
iret = read (h->lp_event_out,
|
||||||
|
#endif
|
||||||
&ev,
|
&ev,
|
||||||
sizeof (ev));
|
sizeof (ev));
|
||||||
if (-1 == iret)
|
if (-1 == iret)
|
||||||
@ -995,7 +1023,7 @@ make_transfer (
|
|||||||
if (NULL != t)
|
if (NULL != t)
|
||||||
{
|
{
|
||||||
if ( (debit_acc != t->debit_account) ||
|
if ( (debit_acc != t->debit_account) ||
|
||||||
(credit_acc != t->credit_account) ||
|
(credit_acc != t->credit_account) ||
|
||||||
(0 != TALER_amount_cmp (amount,
|
(0 != TALER_amount_cmp (amount,
|
||||||
&t->amount)) ||
|
&t->amount)) ||
|
||||||
(T_DEBIT != t->type) ||
|
(T_DEBIT != t->type) ||
|
||||||
@ -1208,7 +1236,11 @@ TALER_FAKEBANK_stop (struct TALER_FAKEBANK_Handle *h)
|
|||||||
h->mhd_rfd = NULL;
|
h->mhd_rfd = NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef __linux__
|
||||||
if (-1 != h->lp_event)
|
if (-1 != h->lp_event)
|
||||||
|
#else
|
||||||
|
if (-1 != h->lp_event_in && -1 != h->lp_event_out)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
uint64_t val = 1;
|
uint64_t val = 1;
|
||||||
void *ret;
|
void *ret;
|
||||||
@ -1221,7 +1253,11 @@ TALER_FAKEBANK_stop (struct TALER_FAKEBANK_Handle *h)
|
|||||||
lp_trigger (lp,
|
lp_trigger (lp,
|
||||||
h);
|
h);
|
||||||
GNUNET_break (sizeof (val) ==
|
GNUNET_break (sizeof (val) ==
|
||||||
|
#ifdef __linux__
|
||||||
write (h->lp_event,
|
write (h->lp_event,
|
||||||
|
#else
|
||||||
|
write (h->lp_event_in,
|
||||||
|
#endif
|
||||||
&val,
|
&val,
|
||||||
sizeof (val)));
|
sizeof (val)));
|
||||||
GNUNET_assert (0 ==
|
GNUNET_assert (0 ==
|
||||||
@ -1230,8 +1266,15 @@ TALER_FAKEBANK_stop (struct TALER_FAKEBANK_Handle *h)
|
|||||||
pthread_join (h->lp_thread,
|
pthread_join (h->lp_thread,
|
||||||
&ret));
|
&ret));
|
||||||
GNUNET_break (NULL == ret);
|
GNUNET_break (NULL == ret);
|
||||||
|
#ifdef __linux__
|
||||||
GNUNET_break (0 == close (h->lp_event));
|
GNUNET_break (0 == close (h->lp_event));
|
||||||
h->lp_event = -1;
|
h->lp_event = -1;
|
||||||
|
#else
|
||||||
|
GNUNET_break (0 == close (h->lp_event_in));
|
||||||
|
GNUNET_break (0 == close (h->lp_event_out));
|
||||||
|
h->lp_event_in = -1;
|
||||||
|
h->lp_event_out = -1;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1343,19 +1386,19 @@ handle_admin_add_incoming (struct TALER_FAKEBANK_Handle *h,
|
|||||||
&json);
|
&json);
|
||||||
switch (pr)
|
switch (pr)
|
||||||
{
|
{
|
||||||
case GNUNET_JSON_PR_OUT_OF_MEMORY:
|
case GNUNET_JSON_PR_OUT_OF_MEMORY:
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
return MHD_NO;
|
return MHD_NO;
|
||||||
case GNUNET_JSON_PR_CONTINUE:
|
case GNUNET_JSON_PR_CONTINUE:
|
||||||
return MHD_YES;
|
return MHD_YES;
|
||||||
case GNUNET_JSON_PR_REQUEST_TOO_LARGE:
|
case GNUNET_JSON_PR_REQUEST_TOO_LARGE:
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
return MHD_NO;
|
return MHD_NO;
|
||||||
case GNUNET_JSON_PR_JSON_INVALID:
|
case GNUNET_JSON_PR_JSON_INVALID:
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
return MHD_NO;
|
return MHD_NO;
|
||||||
case GNUNET_JSON_PR_SUCCESS:
|
case GNUNET_JSON_PR_SUCCESS:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const char *debit_account;
|
const char *debit_account;
|
||||||
@ -1467,19 +1510,19 @@ handle_transfer (struct TALER_FAKEBANK_Handle *h,
|
|||||||
&json);
|
&json);
|
||||||
switch (pr)
|
switch (pr)
|
||||||
{
|
{
|
||||||
case GNUNET_JSON_PR_OUT_OF_MEMORY:
|
case GNUNET_JSON_PR_OUT_OF_MEMORY:
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
return MHD_NO;
|
return MHD_NO;
|
||||||
case GNUNET_JSON_PR_CONTINUE:
|
case GNUNET_JSON_PR_CONTINUE:
|
||||||
return MHD_YES;
|
return MHD_YES;
|
||||||
case GNUNET_JSON_PR_REQUEST_TOO_LARGE:
|
case GNUNET_JSON_PR_REQUEST_TOO_LARGE:
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
return MHD_NO;
|
return MHD_NO;
|
||||||
case GNUNET_JSON_PR_JSON_INVALID:
|
case GNUNET_JSON_PR_JSON_INVALID:
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
return MHD_NO;
|
return MHD_NO;
|
||||||
case GNUNET_JSON_PR_SUCCESS:
|
case GNUNET_JSON_PR_SUCCESS:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
struct GNUNET_HashCode uuid;
|
struct GNUNET_HashCode uuid;
|
||||||
@ -1794,12 +1837,20 @@ reschedule_lp_timeout (struct TALER_FAKEBANK_Handle *h,
|
|||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
"Scheduling timeout task for %s\n",
|
"Scheduling timeout task for %s\n",
|
||||||
GNUNET_STRINGS_absolute_time_to_string (t));
|
GNUNET_STRINGS_absolute_time_to_string (t));
|
||||||
|
#ifdef __linux__
|
||||||
if (-1 != h->lp_event)
|
if (-1 != h->lp_event)
|
||||||
|
#else
|
||||||
|
if (-1 != h->lp_event_in && -1 != h->lp_event_out)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
uint64_t num = 1;
|
uint64_t num = 1;
|
||||||
|
|
||||||
GNUNET_break (sizeof (num) ==
|
GNUNET_break (sizeof (num) ==
|
||||||
|
#ifdef __linux__
|
||||||
write (h->lp_event,
|
write (h->lp_event,
|
||||||
|
#else
|
||||||
|
write (h->lp_event_in,
|
||||||
|
#endif
|
||||||
&num,
|
&num,
|
||||||
sizeof (num)));
|
sizeof (num)));
|
||||||
}
|
}
|
||||||
@ -1922,7 +1973,7 @@ handle_debit_history (struct TALER_FAKEBANK_Handle *h,
|
|||||||
/* If account does not match, linear scan for
|
/* If account does not match, linear scan for
|
||||||
first matching account. */
|
first matching account. */
|
||||||
while ( (! overflow) &&
|
while ( (! overflow) &&
|
||||||
(NULL != t) &&
|
(NULL != t) &&
|
||||||
(t->debit_account != acc) )
|
(t->debit_account != acc) )
|
||||||
{
|
{
|
||||||
skip = false;
|
skip = false;
|
||||||
@ -2453,7 +2504,12 @@ schedule_httpd (struct TALER_FAKEBANK_Handle *h)
|
|||||||
MHD_UNSIGNED_LONG_LONG timeout;
|
MHD_UNSIGNED_LONG_LONG timeout;
|
||||||
struct GNUNET_TIME_Relative tv;
|
struct GNUNET_TIME_Relative tv;
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
GNUNET_assert (-1 == h->lp_event);
|
GNUNET_assert (-1 == h->lp_event);
|
||||||
|
#else
|
||||||
|
GNUNET_assert (-1 == h->lp_event_in);
|
||||||
|
GNUNET_assert (-1 == h->lp_event_out);
|
||||||
|
#endif
|
||||||
FD_ZERO (&rs);
|
FD_ZERO (&rs);
|
||||||
FD_ZERO (&ws);
|
FD_ZERO (&ws);
|
||||||
FD_ZERO (&es);
|
FD_ZERO (&es);
|
||||||
@ -2525,7 +2581,12 @@ run_mhd (void *cls)
|
|||||||
h->mhd_again = false;
|
h->mhd_again = false;
|
||||||
MHD_run (h->mhd_bank);
|
MHD_run (h->mhd_bank);
|
||||||
}
|
}
|
||||||
|
#ifdef __linux__
|
||||||
GNUNET_assert (-1 == h->lp_event);
|
GNUNET_assert (-1 == h->lp_event);
|
||||||
|
#else
|
||||||
|
GNUNET_assert (-1 == h->lp_event_in);
|
||||||
|
GNUNET_assert (-1 == h->lp_event_out);
|
||||||
|
#endif
|
||||||
schedule_httpd (h);
|
schedule_httpd (h);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2558,8 +2619,15 @@ TALER_FAKEBANK_start2 (uint16_t port,
|
|||||||
}
|
}
|
||||||
GNUNET_assert (strlen (currency) < TALER_CURRENCY_LEN);
|
GNUNET_assert (strlen (currency) < TALER_CURRENCY_LEN);
|
||||||
h = GNUNET_new (struct TALER_FAKEBANK_Handle);
|
h = GNUNET_new (struct TALER_FAKEBANK_Handle);
|
||||||
|
#ifdef __linux__
|
||||||
h->lp_event = -1;
|
h->lp_event = -1;
|
||||||
|
#else
|
||||||
|
h->lp_event_in = -1;
|
||||||
|
h->lp_event_out = -1;
|
||||||
|
#endif
|
||||||
|
#if EPOLL_SUPPORT
|
||||||
h->mhd_fd = -1;
|
h->mhd_fd = -1;
|
||||||
|
#endif
|
||||||
h->port = port;
|
h->port = port;
|
||||||
h->ram_limit = ram_limit;
|
h->ram_limit = ram_limit;
|
||||||
h->serial_counter = 0;
|
h->serial_counter = 0;
|
||||||
@ -2642,6 +2710,7 @@ TALER_FAKEBANK_start2 (uint16_t port,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#ifdef __linux__
|
||||||
h->lp_event = eventfd (0,
|
h->lp_event = eventfd (0,
|
||||||
EFD_CLOEXEC);
|
EFD_CLOEXEC);
|
||||||
if (-1 == h->lp_event)
|
if (-1 == h->lp_event)
|
||||||
@ -2651,6 +2720,20 @@ TALER_FAKEBANK_start2 (uint16_t port,
|
|||||||
TALER_FAKEBANK_stop (h);
|
TALER_FAKEBANK_stop (h);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
{
|
||||||
|
int pipefd[2];
|
||||||
|
if (0 != pipe (pipefd))
|
||||||
|
{
|
||||||
|
GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,
|
||||||
|
"pipe");
|
||||||
|
TALER_FAKEBANK_stop (h);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
h->lp_event_out = pipefd[0];
|
||||||
|
h->lp_event_in = pipefd[1];
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (0 !=
|
if (0 !=
|
||||||
pthread_create (&h->lp_thread,
|
pthread_create (&h->lp_thread,
|
||||||
NULL,
|
NULL,
|
||||||
@ -2659,8 +2742,15 @@ TALER_FAKEBANK_start2 (uint16_t port,
|
|||||||
{
|
{
|
||||||
GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,
|
GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,
|
||||||
"pthread_create");
|
"pthread_create");
|
||||||
|
#ifdef __linux__
|
||||||
GNUNET_break (0 == close (h->lp_event));
|
GNUNET_break (0 == close (h->lp_event));
|
||||||
h->lp_event = -1;
|
h->lp_event = -1;
|
||||||
|
#else
|
||||||
|
GNUNET_break (0 == close (h->lp_event_in));
|
||||||
|
GNUNET_break (0 == close (h->lp_event_out));
|
||||||
|
h->lp_event_in = -1;
|
||||||
|
h->lp_event_out = -1;
|
||||||
|
#endif
|
||||||
TALER_FAKEBANK_stop (h);
|
TALER_FAKEBANK_stop (h);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
#include "taler_exchangedb_plugin.h"
|
#include "taler_exchangedb_plugin.h"
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <sys/eventfd.h>
|
|
||||||
#include <libpq-fe.h>
|
#include <libpq-fe.h>
|
||||||
|
|
||||||
#include "plugin_exchangedb_common.c"
|
#include "plugin_exchangedb_common.c"
|
||||||
|
@ -435,4 +435,18 @@ const char *
|
|||||||
TALER_yna_to_string (enum TALER_EXCHANGE_YesNoAll yna);
|
TALER_yna_to_string (enum TALER_EXCHANGE_YesNoAll yna);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
/**
|
||||||
|
* Returns the first occurence of `c` in `s`, or returns the null-byte
|
||||||
|
* terminating the string if it does not occur.
|
||||||
|
*
|
||||||
|
* @param s the string to search in
|
||||||
|
* @param c the character to search for
|
||||||
|
* @return char* the first occurence of `c` in `s`
|
||||||
|
*/
|
||||||
|
char * strchrnul (const char *s, int c);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -23,7 +23,9 @@
|
|||||||
#include "taler_signatures.h"
|
#include "taler_signatures.h"
|
||||||
#include "secmod_common.h"
|
#include "secmod_common.h"
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
|
#ifdef __linux__
|
||||||
#include <sys/eventfd.h>
|
#include <sys/eventfd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -217,7 +219,11 @@ TES_wake_clients (void)
|
|||||||
client = client->next)
|
client = client->next)
|
||||||
{
|
{
|
||||||
GNUNET_assert (sizeof (num) ==
|
GNUNET_assert (sizeof (num) ==
|
||||||
|
#ifdef __linux__
|
||||||
write (client->esock,
|
write (client->esock,
|
||||||
|
#else
|
||||||
|
write (client->esock_in,
|
||||||
|
#endif
|
||||||
&num,
|
&num,
|
||||||
sizeof (num)));
|
sizeof (num)));
|
||||||
}
|
}
|
||||||
@ -243,7 +249,7 @@ TES_read_work (void *cls,
|
|||||||
recv_size = recv (client->csock,
|
recv_size = recv (client->csock,
|
||||||
&buf[off],
|
&buf[off],
|
||||||
sizeof (client->iobuf) - off,
|
sizeof (client->iobuf) - off,
|
||||||
0);
|
0);
|
||||||
if (-1 == recv_size)
|
if (-1 == recv_size)
|
||||||
{
|
{
|
||||||
if ( (0 == off) &&
|
if ( (0 == off) &&
|
||||||
@ -309,7 +315,11 @@ TES_await_ready (struct TES_Client *client)
|
|||||||
.events = POLLIN
|
.events = POLLIN
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
#ifdef __linux__
|
||||||
.fd = client->esock,
|
.fd = client->esock,
|
||||||
|
#else
|
||||||
|
.fd = client->esock_out,
|
||||||
|
#endif
|
||||||
.events = POLLIN
|
.events = POLLIN
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -324,13 +334,21 @@ TES_await_ready (struct TES_Client *client)
|
|||||||
"poll");
|
"poll");
|
||||||
for (int i = 0; i<2; i++)
|
for (int i = 0; i<2; i++)
|
||||||
{
|
{
|
||||||
|
#ifdef __linux__
|
||||||
if ( (pfds[i].fd == client->esock) &&
|
if ( (pfds[i].fd == client->esock) &&
|
||||||
|
#else
|
||||||
|
if ( (pfds[i].fd == client->esock_out) &&
|
||||||
|
#endif
|
||||||
(POLLIN == pfds[i].revents) )
|
(POLLIN == pfds[i].revents) )
|
||||||
{
|
{
|
||||||
uint64_t num;
|
uint64_t num;
|
||||||
|
|
||||||
GNUNET_assert (sizeof (num) ==
|
GNUNET_assert (sizeof (num) ==
|
||||||
|
#ifdef __linux__
|
||||||
read (client->esock,
|
read (client->esock,
|
||||||
|
#else
|
||||||
|
read (client->esock_out,
|
||||||
|
#endif
|
||||||
&num,
|
&num,
|
||||||
sizeof (num)));
|
sizeof (num)));
|
||||||
return true;
|
return true;
|
||||||
@ -349,7 +367,12 @@ TES_free_client (struct TES_Client *client)
|
|||||||
client);
|
client);
|
||||||
GNUNET_assert (0 == pthread_mutex_unlock (&TES_clients_lock));
|
GNUNET_assert (0 == pthread_mutex_unlock (&TES_clients_lock));
|
||||||
GNUNET_break (0 == close (client->csock));
|
GNUNET_break (0 == close (client->csock));
|
||||||
|
#ifdef __linux__
|
||||||
GNUNET_break (0 == close (client->esock));
|
GNUNET_break (0 == close (client->esock));
|
||||||
|
#else
|
||||||
|
GNUNET_break (0 == close (client->esock_in));
|
||||||
|
GNUNET_break (0 == close (client->esock_out));
|
||||||
|
#endif
|
||||||
pthread_detach (client->worker);
|
pthread_detach (client->worker);
|
||||||
GNUNET_free (client);
|
GNUNET_free (client);
|
||||||
}
|
}
|
||||||
@ -401,7 +424,11 @@ listen_job (void *cls)
|
|||||||
{
|
{
|
||||||
const struct TES_Callbacks *cb = cls;
|
const struct TES_Callbacks *cb = cls;
|
||||||
int s;
|
int s;
|
||||||
|
#ifdef __linux__
|
||||||
int e;
|
int e;
|
||||||
|
#else
|
||||||
|
int e[2];
|
||||||
|
#endif
|
||||||
struct sockaddr_storage sa;
|
struct sockaddr_storage sa;
|
||||||
socklen_t sa_len = sizeof (sa);
|
socklen_t sa_len = sizeof (sa);
|
||||||
|
|
||||||
@ -418,6 +445,7 @@ listen_job (void *cls)
|
|||||||
"accept");
|
"accept");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#ifdef __linux__
|
||||||
e = eventfd (0,
|
e = eventfd (0,
|
||||||
EFD_CLOEXEC);
|
EFD_CLOEXEC);
|
||||||
if (-1 == e)
|
if (-1 == e)
|
||||||
@ -427,13 +455,27 @@ listen_job (void *cls)
|
|||||||
GNUNET_break (0 == close (s));
|
GNUNET_break (0 == close (s));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if (0 != pipe (e))
|
||||||
|
{
|
||||||
|
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
|
||||||
|
"pipe");
|
||||||
|
GNUNET_break (0 == close (s));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
struct TES_Client *client;
|
struct TES_Client *client;
|
||||||
|
|
||||||
client = GNUNET_new (struct TES_Client);
|
client = GNUNET_new (struct TES_Client);
|
||||||
client->cb = *cb;
|
client->cb = *cb;
|
||||||
client->csock = s;
|
client->csock = s;
|
||||||
|
#ifdef __linux__
|
||||||
client->esock = e;
|
client->esock = e;
|
||||||
|
#else
|
||||||
|
client->esock_in = e[1];
|
||||||
|
client->esock_out = e[0];
|
||||||
|
#endif
|
||||||
GNUNET_assert (0 == pthread_mutex_lock (&TES_clients_lock));
|
GNUNET_assert (0 == pthread_mutex_lock (&TES_clients_lock));
|
||||||
GNUNET_CONTAINER_DLL_insert (TES_clients_head,
|
GNUNET_CONTAINER_DLL_insert (TES_clients_head,
|
||||||
TES_clients_tail,
|
TES_clients_tail,
|
||||||
|
@ -155,10 +155,22 @@ struct TES_Client
|
|||||||
*/
|
*/
|
||||||
int csock;
|
int csock;
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
/**
|
/**
|
||||||
* Event socket.
|
* Event socket.
|
||||||
*/
|
*/
|
||||||
int esock;
|
int esock;
|
||||||
|
#else
|
||||||
|
/**
|
||||||
|
* Input end of the event pipe.
|
||||||
|
*/
|
||||||
|
int esock_in;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output end of the event pipe.
|
||||||
|
*/
|
||||||
|
int esock_out;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,7 +37,6 @@
|
|||||||
#include "taler-exchange-secmod-eddsa.h"
|
#include "taler-exchange-secmod-eddsa.h"
|
||||||
#include <gcrypt.h>
|
#include <gcrypt.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <sys/eventfd.h>
|
|
||||||
#include "taler_error_codes.h"
|
#include "taler_error_codes.h"
|
||||||
#include "taler_signatures.h"
|
#include "taler_signatures.h"
|
||||||
#include "secmod_common.h"
|
#include "secmod_common.h"
|
||||||
|
@ -36,7 +36,6 @@
|
|||||||
#include "taler-exchange-secmod-rsa.h"
|
#include "taler-exchange-secmod-rsa.h"
|
||||||
#include <gcrypt.h>
|
#include <gcrypt.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <sys/eventfd.h>
|
|
||||||
#include "taler_error_codes.h"
|
#include "taler_error_codes.h"
|
||||||
#include "taler_signatures.h"
|
#include "taler_signatures.h"
|
||||||
#include "secmod_common.h"
|
#include "secmod_common.h"
|
||||||
|
@ -46,4 +46,21 @@ TALER_b2s (const void *buf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
char *
|
||||||
|
strchrnul (const char *s,
|
||||||
|
int c)
|
||||||
|
{
|
||||||
|
char *value;
|
||||||
|
value = strchr (s,
|
||||||
|
c);
|
||||||
|
if (NULL == value)
|
||||||
|
value = &s[strlen (s)];
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* end of util.c */
|
/* end of util.c */
|
||||||
|
Loading…
Reference in New Issue
Block a user