GNUnet  0.11.x
Data Structures | Macros | Functions
seti_api.c File Reference

api for the set service More...

#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_protocols.h"
#include "gnunet_seti_service.h"
#include "seti.h"
Include dependency graph for seti_api.c:

Go to the source code of this file.

Data Structures

struct  GNUNET_SETI_Handle
 Opaque handle to a set. More...
 
struct  GNUNET_SETI_Request
 Handle for a set operation request from another peer. More...
 
struct  GNUNET_SETI_OperationHandle
 Handle to an operation. More...
 
struct  GNUNET_SETI_ListenHandle
 Opaque handle to a listen operation. More...
 

Macros

#define LOG(kind, ...)   GNUNET_log_from (kind, "seti-api", __VA_ARGS__)
 

Functions

static int check_result (void *cls, const struct GNUNET_SETI_ResultMessage *msg)
 Check that the given msg is well-formed. More...
 
static void handle_result (void *cls, const struct GNUNET_SETI_ResultMessage *msg)
 Handle result message for a set operation. More...
 
static void set_operation_destroy (struct GNUNET_SETI_OperationHandle *oh)
 Destroy the given set operation. More...
 
void GNUNET_SETI_operation_cancel (struct GNUNET_SETI_OperationHandle *oh)
 Cancel the given set operation. More...
 
static void handle_client_set_error (void *cls, enum GNUNET_MQ_Error error)
 We encountered an error communicating with the set service while performing a set operation. More...
 
struct GNUNET_SETI_HandleGNUNET_SETI_create (const struct GNUNET_CONFIGURATION_Handle *cfg)
 Create an empty set. More...
 
int GNUNET_SETI_add_element (struct GNUNET_SETI_Handle *set, const struct GNUNET_SETI_Element *element, GNUNET_SCHEDULER_TaskCallback cb, void *cb_cls)
 Add an element to the given set. More...
 
void GNUNET_SETI_destroy (struct GNUNET_SETI_Handle *set)
 Destroy the set handle if no operations are left, mark the set for destruction otherwise. More...
 
struct GNUNET_SETI_OperationHandleGNUNET_SETI_prepare (const struct GNUNET_PeerIdentity *other_peer, const struct GNUNET_HashCode *app_id, const struct GNUNET_MessageHeader *context_msg, const struct GNUNET_SETI_Option options[], GNUNET_SETI_ResultIterator result_cb, void *result_cls)
 Prepare a set operation to be evaluated with another peer. More...
 
static void listen_connect (void *cls)
 Connect to the set service in order to listen for requests. More...
 
static int check_request (void *cls, const struct GNUNET_SETI_RequestMessage *msg)
 Check validity of request message for a listen operation. More...
 
static void handle_request (void *cls, const struct GNUNET_SETI_RequestMessage *msg)
 Handle request message for a listen operation. More...
 
static void handle_client_listener_error (void *cls, enum GNUNET_MQ_Error error)
 Our connection with the set service encountered an error, re-initialize with exponential back-off. More...
 
struct GNUNET_SETI_ListenHandleGNUNET_SETI_listen (const struct GNUNET_CONFIGURATION_Handle *cfg, const struct GNUNET_HashCode *app_id, GNUNET_SETI_ListenCallback listen_cb, void *listen_cls)
 Wait for set operation requests for the given application id. More...
 
void GNUNET_SETI_listen_cancel (struct GNUNET_SETI_ListenHandle *lh)
 Cancel the given listen operation. More...
 
struct GNUNET_SETI_OperationHandleGNUNET_SETI_accept (struct GNUNET_SETI_Request *request, const struct GNUNET_SETI_Option options[], GNUNET_SETI_ResultIterator result_cb, void *result_cls)
 Accept a request we got via GNUNET_SETI_listen. More...
 
int GNUNET_SETI_commit (struct GNUNET_SETI_OperationHandle *oh, struct GNUNET_SETI_Handle *set)
 Commit a set to be used with a set operation. More...
 
void GNUNET_SETI_element_hash (const struct GNUNET_SETI_Element *element, struct GNUNET_HashCode *ret_hash)
 Hash a set element. More...
 

Detailed Description

api for the set service

Author
Florian Dold
Christian Grothoff

Definition in file seti_api.c.

Macro Definition Documentation

◆ LOG

#define LOG (   kind,
  ... 
)    GNUNET_log_from (kind, "seti-api", __VA_ARGS__)

Function Documentation

◆ check_result()

static int check_result ( void *  cls,
const struct GNUNET_SETI_ResultMessage msg 
)
static

Check that the given msg is well-formed.

Parameters
clsclosure
msgmessage to check
Returns
GNUNET_OK if message is well-formed

Definition at line 213 of file seti_api.c.

References GNUNET_OK.

215 {
216  /* minimum size was already checked, everything else is OK! */
217  return GNUNET_OK;
218 }

◆ handle_result()

static void handle_result ( void *  cls,
const struct GNUNET_SETI_ResultMessage msg 
)
static

Handle result message for a set operation.

Parameters
clsthe set
mhthe message

Definition at line 228 of file seti_api.c.

References GNUNET_SETI_ResultMessage::current_size, GNUNET_SETI_Element::data, GNUNET_SETI_Element::element_type, GNUNET_SETI_ResultMessage::element_type, GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_MQ_assoc_get(), GNUNET_MQ_assoc_remove(), GNUNET_ntohll(), GNUNET_SETI_destroy(), GNUNET_SETI_STATUS_ADD_LOCAL, GNUNET_SETI_STATUS_DEL_LOCAL, GNUNET_SETI_STATUS_DONE, GNUNET_SETI_STATUS_FAILURE, GNUNET_YES, GNUNET_SETI_ResultMessage::header, LOG, oh, GNUNET_SETI_ResultMessage::request_id, GNUNET_SETI_OperationHandle::result_cb, GNUNET_SETI_OperationHandle::result_cls, GNUNET_SETI_ResultMessage::result_status, GNUNET_SETI_Element::size, and GNUNET_MessageHeader::size.

230 {
231  struct GNUNET_SETI_Handle *set = cls;
233  struct GNUNET_SETI_Element e;
234  enum GNUNET_SETI_Status result_status;
235  int destroy_set;
236 
237  GNUNET_assert (NULL != set->mq);
238  result_status = (enum GNUNET_SETI_Status) ntohs (msg->result_status);
240  "Got result message with status %d\n",
241  result_status);
242  oh = GNUNET_MQ_assoc_get (set->mq,
243  ntohl (msg->request_id));
244  if (NULL == oh)
245  {
246  /* 'oh' can be NULL if we canceled the operation, but the service
247  did not get the cancel message yet. */
249  "Ignoring result from canceled operation\n");
250  return;
251  }
252 
253  switch (result_status)
254  {
257  e.data = &msg[1];
258  e.size = ntohs (msg->header.size)
259  - sizeof(struct GNUNET_SETI_ResultMessage);
260  e.element_type = ntohs (msg->element_type);
261  if (NULL != oh->result_cb)
262  oh->result_cb (oh->result_cls,
263  &e,
265  result_status);
266  return;
269  GNUNET_MQ_assoc_remove (set->mq,
270  ntohl (msg->request_id));
271  GNUNET_CONTAINER_DLL_remove (set->ops_head,
272  set->ops_tail,
273  oh);
274  /* Need to do this calculation _before_ the result callback,
275  as IF the application still has a valid set handle, it
276  may trigger destruction of the set during the callback. */
277  destroy_set = (GNUNET_YES == set->destroy_requested) &&
278  (NULL == set->ops_head);
279  if (NULL != oh->result_cb)
280  {
281  oh->result_cb (oh->result_cls,
282  NULL,
284  result_status);
285  }
286  else
287  {
289  "No callback for final status\n");
290  }
291  if (destroy_set)
292  GNUNET_SETI_destroy (set);
293  GNUNET_free (oh);
294  return;
295  }
296 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
Success, all elements have been sent (and received).
Message sent by the service to the client to indicate an element that is removed (set intersection) o...
Definition: seti.h:191
The other peer refused to do the operation with us, or something went wrong.
uint64_t current_size
Current set size.
Definition: seti.h:201
struct GNUNET_MessageHeader header
Type: GNUNET_MESSAGE_TYPE_SETI_RESULT.
Definition: seti.h:196
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static struct Experiment * e
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
void * result_cls
Closure for result_cb.
Definition: seti_api.c:116
Element should be added to the result set of the local peer, i.e.
Opaque handle to a set.
Definition: seti_api.c:39
uint32_t request_id
id the result belongs to
Definition: seti.h:206
static struct GNUNET_TRANSPORT_OfferHelloHandle * oh
Active HELLO offering to transport service.
Element stored in a set.
#define LOG(kind,...)
Definition: seti_api.c:33
Handle to an operation.
Definition: seti_api.c:105
Element should be delete from the result set of the local peer, i.e.
GNUNET_SETI_Status
Status for the result callback.
void * GNUNET_MQ_assoc_remove(struct GNUNET_MQ_Handle *mq, uint32_t request_id)
Remove the association for a request_id.
Definition: mq.c:765
uint16_t result_status
Was the evaluation successful? Contains an enum GNUNET_SETI_Status in NBO.
Definition: seti.h:212
#define GNUNET_log(kind,...)
GNUNET_SETI_ResultIterator result_cb
Function to be called when we have a result, or an error.
Definition: seti_api.c:111
uint64_t GNUNET_ntohll(uint64_t n)
Convert unsigned 64-bit integer to host byte order.
Definition: common_endian.c:53
uint16_t element_type
Type of the element attachted to the message, if any.
Definition: seti.h:217
#define GNUNET_free(ptr)
Wrapper around free.
void GNUNET_SETI_destroy(struct GNUNET_SETI_Handle *set)
Destroy the set handle if no operations are left, mark the set for destruction otherwise.
Definition: seti_api.c:488
void * GNUNET_MQ_assoc_get(struct GNUNET_MQ_Handle *mq, uint32_t request_id)
Get the data associated with a request_id in a queue.
Definition: mq.c:749
Here is the call graph for this function:

◆ set_operation_destroy()

static void set_operation_destroy ( struct GNUNET_SETI_OperationHandle oh)
static

Destroy the given set operation.

Parameters
ohset operation to destroy

Definition at line 305 of file seti_api.c.

References GNUNET_SETI_OperationHandle::conclude_mqm, GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_MQ_assoc_remove(), GNUNET_MQ_discard(), GNUNET_SETI_Handle::mq, GNUNET_SETI_Handle::ops_head, GNUNET_SETI_Handle::ops_tail, GNUNET_SETI_OperationHandle::request_id, and GNUNET_SETI_OperationHandle::set.

Referenced by GNUNET_SETI_operation_cancel(), and handle_client_set_error().

306 {
307  struct GNUNET_SETI_Handle *set = oh->set;
308  struct GNUNET_SETI_OperationHandle *h_assoc;
309 
310  if (NULL != oh->conclude_mqm)
312  /* is the operation already commited? */
313  if (NULL != set)
314  {
316  set->ops_tail,
317  oh);
318  h_assoc = GNUNET_MQ_assoc_remove (set->mq,
319  oh->request_id);
320  GNUNET_assert ((NULL == h_assoc) ||
321  (h_assoc == oh));
322  }
323  GNUNET_free (oh);
324 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
Opaque handle to a set.
Definition: seti_api.c:39
struct GNUNET_MQ_Envelope * conclude_mqm
Message sent to the server on calling conclude, NULL if conclude has been called. ...
Definition: seti_api.c:128
struct GNUNET_SETI_OperationHandle * ops_tail
Linked list of operations on the set.
Definition: seti_api.c:54
Handle to an operation.
Definition: seti_api.c:105
void GNUNET_MQ_discard(struct GNUNET_MQ_Envelope *mqm)
Discard the message queue message, free all allocated resources.
Definition: mq.c:323
uint32_t request_id
Request ID to identify the operation within the set.
Definition: seti_api.c:149
struct GNUNET_SETI_Handle * set
Local set used for the operation, NULL if no set has been provided by conclude yet.
Definition: seti_api.c:122
void * GNUNET_MQ_assoc_remove(struct GNUNET_MQ_Handle *mq, uint32_t request_id)
Remove the association for a request_id.
Definition: mq.c:765
struct GNUNET_SETI_OperationHandle * ops_head
Linked list of operations on the set.
Definition: seti_api.c:49
struct GNUNET_MQ_Handle * mq
Message queue for client.
Definition: seti_api.c:44
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_client_set_error()

static void handle_client_set_error ( void *  cls,
enum GNUNET_MQ_Error  error 
)
static

We encountered an error communicating with the set service while performing a set operation.

Report to the application.

Parameters
clsthe struct GNUNET_SETI_Handle
errorerror code

Definition at line 369 of file seti_api.c.

References GNUNET_ERROR_TYPE_ERROR, GNUNET_NO, GNUNET_SETI_STATUS_FAILURE, GNUNET_YES, LOG, and set_operation_destroy().

Referenced by GNUNET_SETI_create().

371 {
372  struct GNUNET_SETI_Handle *set = cls;
373 
375  "Handling client set error %d\n",
376  error);
377  while (NULL != set->ops_head)
378  {
379  if ((NULL != set->ops_head->result_cb) &&
380  (GNUNET_NO == set->destroy_requested))
381  set->ops_head->result_cb (set->ops_head->result_cls,
382  NULL,
383  0,
385  set_operation_destroy (set->ops_head);
386  }
387  set->invalid = GNUNET_YES;
388 }
The other peer refused to do the operation with us, or something went wrong.
Opaque handle to a set.
Definition: seti_api.c:39
#define LOG(kind,...)
Definition: seti_api.c:33
static void set_operation_destroy(struct GNUNET_SETI_OperationHandle *oh)
Destroy the given set operation.
Definition: seti_api.c:305
Here is the call graph for this function:
Here is the caller graph for this function:

◆ listen_connect()

static void listen_connect ( void *  cls)
static

Connect to the set service in order to listen for requests.

Parameters
clsthe struct GNUNET_SETI_ListenHandle * to connect

Definition at line 674 of file seti_api.c.

References GNUNET_SETI_ListenMessage::app_id, GNUNET_SETI_ListenHandle::app_id, GNUNET_SETI_ListenHandle::cfg, GNUNET_assert, GNUNET_CLIENT_connect(), GNUNET_MESSAGE_TYPE_SETI_LISTEN, GNUNET_MESSAGE_TYPE_SETI_REQUEST, GNUNET_MQ_handler_end, GNUNET_MQ_hd_var_size, GNUNET_MQ_msg, GNUNET_MQ_send(), handle_client_listener_error(), GNUNET_SETI_ListenHandle::mq, msg, GNUNET_SETI_ListenHandle::reconnect_task, and request.

Referenced by GNUNET_SETI_listen(), GNUNET_SETI_prepare(), and handle_client_listener_error().

675 {
676  struct GNUNET_SETI_ListenHandle *lh = cls;
677  struct GNUNET_MQ_MessageHandler mq_handlers[] = {
681  lh),
683  };
684  struct GNUNET_MQ_Envelope *mqm;
686 
687  lh->reconnect_task = NULL;
688  GNUNET_assert (NULL == lh->mq);
689  lh->mq = GNUNET_CLIENT_connect (lh->cfg,
690  "seti",
691  mq_handlers,
693  lh);
694  if (NULL == lh->mq)
695  return;
697  msg->app_id = lh->app_id;
698  GNUNET_MQ_send (lh->mq,
699  mqm);
700 }
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
static struct GNUNET_VPN_RedirectionRequest * request
Opaque redirection request handle.
Definition: gnunet-vpn.c:41
struct GNUNET_MQ_Handle * GNUNET_CLIENT_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *service_name, const struct GNUNET_MQ_MessageHandler *handlers, GNUNET_MQ_ErrorHandler error_handler, void *error_handler_cls)
Create a message queue to connect to a GNUnet service.
Definition: client.c:1063
#define GNUNET_MESSAGE_TYPE_SETI_REQUEST
Notify the client of an incoming request from a remote peer.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:67
Opaque handle to a listen operation.
Definition: seti_api.c:162
Message sent by the client to the service to start listening for incoming requests to perform a certa...
Definition: seti.h:53
struct GNUNET_HashCode app_id
application id
Definition: seti.h:68
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration handle for the listener, stored here to be able to reconnect transparently on connectio...
Definition: seti_api.c:174
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
static void handle_client_listener_error(void *cls, enum GNUNET_MQ_Error error)
Our connection with the set service encountered an error, re-initialize with exponential back-off...
Definition: seti_api.c:651
Message handler for a specific message type.
#define GNUNET_MESSAGE_TYPE_SETI_LISTEN
Listen for operation requests.
struct GNUNET_SCHEDULER_Task * reconnect_task
Task for reconnecting when the listener fails.
Definition: seti_api.c:190
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:355
A request for an operation with another client.
Definition: seti.h:123
struct GNUNET_MQ_Handle * mq
Message queue for the client.
Definition: seti_api.c:167
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
struct GNUNET_HashCode app_id
Application ID we listen for.
Definition: seti_api.c:195
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_request()

static int check_request ( void *  cls,
const struct GNUNET_SETI_RequestMessage msg 
)
static

Check validity of request message for a listen operation.

Parameters
clsthe listen handle
msgthe message
Returns
GNUNET_OK if the message is well-formed

Definition at line 583 of file seti_api.c.

References GNUNET_break_op, GNUNET_MQ_extract_nested_mh, GNUNET_OK, GNUNET_SYSERR, GNUNET_SETI_RequestMessage::header, and GNUNET_MessageHeader::size.

585 {
586  const struct GNUNET_MessageHeader *context_msg;
587 
588  if (ntohs (msg->header.size) == sizeof(*msg))
589  return GNUNET_OK; /* no context message is OK */
590  context_msg = GNUNET_MQ_extract_nested_mh (msg);
591  if (NULL == context_msg)
592  {
593  /* malformed context message is NOT ok */
594  GNUNET_break_op (0);
595  return GNUNET_SYSERR;
596  }
597  return GNUNET_OK;
598 }
#define GNUNET_MQ_extract_nested_mh(var)
Return a pointer to the message at the end of the given message.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
struct GNUNET_MessageHeader header
Type: GNUNET_MESSAGE_TYPE_SETI_REQUEST.
Definition: seti.h:128
Header for all communications.

◆ handle_request()

static void handle_request ( void *  cls,
const struct GNUNET_SETI_RequestMessage msg 
)
static

Handle request message for a listen operation.

Parameters
clsthe listen handle
msgthe message

Definition at line 608 of file seti_api.c.

References GNUNET_SETI_Request::accept_id, GNUNET_SETI_RequestMessage::accept_id, GNUNET_SETI_RejectMessage::accept_reject_id, GNUNET_SETI_Request::accepted, GNUNET_ERROR_TYPE_DEBUG, GNUNET_MESSAGE_TYPE_SETI_REJECT, GNUNET_MQ_extract_nested_mh, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_NO, GNUNET_TIME_UNIT_MILLISECONDS, GNUNET_YES, GNUNET_SETI_ListenHandle::listen_cb, GNUNET_SETI_ListenHandle::listen_cls, LOG, GNUNET_SETI_ListenHandle::mq, GNUNET_SETI_RequestMessage::peer_id, and GNUNET_SETI_ListenHandle::reconnect_backoff.

610 {
611  struct GNUNET_SETI_ListenHandle *lh = cls;
612  struct GNUNET_SETI_Request req;
613  const struct GNUNET_MessageHeader *context_msg;
614  struct GNUNET_MQ_Envelope *mqm;
615  struct GNUNET_SETI_RejectMessage *rmsg;
616 
618  "Processing incoming operation request with id %u\n",
619  ntohl (msg->accept_id));
620  /* we got another valid request => reset the backoff */
622  req.accept_id = ntohl (msg->accept_id);
623  req.accepted = GNUNET_NO;
624  context_msg = GNUNET_MQ_extract_nested_mh (msg);
625  /* calling #GNUNET_SETI_accept() in the listen cb will set req->accepted */
626  lh->listen_cb (lh->listen_cls,
627  &msg->peer_id,
628  context_msg,
629  &req);
630  if (GNUNET_YES == req.accepted)
631  return; /* the accept-case is handled in #GNUNET_SETI_accept() */
633  "Rejected request %u\n",
634  ntohl (msg->accept_id));
635  mqm = GNUNET_MQ_msg (rmsg,
637  rmsg->accept_reject_id = msg->accept_id;
638  GNUNET_MQ_send (lh->mq,
639  mqm);
640 }
uint32_t accept_id
ID of the to identify the request when accepting or rejecting it.
Definition: seti.h:134
#define GNUNET_MQ_extract_nested_mh(var)
Return a pointer to the message at the end of the given message.
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:67
Message sent by a listening client to the service to reject performing the operation with the other p...
Definition: seti.h:106
void * listen_cls
Closure for listen_cb.
Definition: seti_api.c:185
Opaque handle to a listen operation.
Definition: seti_api.c:162
Handle for a set operation request from another peer.
Definition: seti_api.c:85
#define GNUNET_MESSAGE_TYPE_SETI_REJECT
Reject a set request.
uint32_t accept_reject_id
ID of the incoming request we want to reject.
Definition: seti.h:116
#define LOG(kind,...)
Definition: seti_api.c:33
#define GNUNET_TIME_UNIT_MILLISECONDS
One millisecond.
struct GNUNET_PeerIdentity peer_id
Identity of the requesting peer.
Definition: seti.h:139
struct GNUNET_TIME_Relative reconnect_backoff
Time to wait until we try to reconnect on failure.
Definition: seti_api.c:200
GNUNET_SETI_ListenCallback listen_cb
Function to call on a new incoming request, or on error.
Definition: seti_api.c:180
Header for all communications.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:355
struct GNUNET_MQ_Handle * mq
Message queue for the client.
Definition: seti_api.c:167
Here is the call graph for this function:

◆ handle_client_listener_error()

static void handle_client_listener_error ( void *  cls,
enum GNUNET_MQ_Error  error 
)
static

Our connection with the set service encountered an error, re-initialize with exponential back-off.

Parameters
clsthe struct GNUNET_SETI_ListenHandle *
errorreason for the disconnect

Definition at line 651 of file seti_api.c.

References GNUNET_ERROR_TYPE_DEBUG, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_add_delayed(), GNUNET_TIME_STD_BACKOFF, listen_connect(), LOG, GNUNET_SETI_ListenHandle::mq, GNUNET_SETI_ListenHandle::reconnect_backoff, and GNUNET_SETI_ListenHandle::reconnect_task.

Referenced by listen_connect().

653 {
654  struct GNUNET_SETI_ListenHandle *lh = cls;
655 
657  "Listener broke down (%d), re-connecting\n",
658  (int) error);
659  GNUNET_MQ_destroy (lh->mq);
660  lh->mq = NULL;
663  lh);
665 }
Opaque handle to a listen operation.
Definition: seti_api.c:162
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition: scheduler.c:1269
#define LOG(kind,...)
Definition: seti_api.c:33
static void listen_connect(void *cls)
Connect to the set service in order to listen for requests.
Definition: seti_api.c:674
#define GNUNET_TIME_STD_BACKOFF(r)
Perform our standard exponential back-off calculation, starting at 1 ms and then going by a factor of...
struct GNUNET_TIME_Relative reconnect_backoff
Time to wait until we try to reconnect on failure.
Definition: seti_api.c:200
struct GNUNET_SCHEDULER_Task * reconnect_task
Task for reconnecting when the listener fails.
Definition: seti_api.c:190
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
Definition: mq.c:837
struct GNUNET_MQ_Handle * mq
Message queue for the client.
Definition: seti_api.c:167
Here is the call graph for this function:
Here is the caller graph for this function: