Exemplo n.º 1
0
/*
  handle a socket write event
*/
static void messaging_send_handler(struct messaging_context *msg)
{
	while (msg->pending) {
		struct messaging_rec *rec = msg->pending;
		NTSTATUS status;
		status = try_send(rec);
		if (NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES)) {
			rec->retries++;
			if (rec->retries > 3) {
				/* we're getting continuous write errors -
				   backoff this record */
				DLIST_REMOVE(msg->pending, rec);
				DLIST_ADD_END(msg->retry_queue, rec, 
					      struct messaging_rec *);
				if (msg->retry_te == NULL) {
					msg->retry_te = 
						event_add_timed(msg->event.ev, msg, 
								timeval_current_ofs(1, 0), 
								msg_retry_timer, msg);
				}
			}
			break;
		}
		rec->retries = 0;
		if (!NT_STATUS_IS_OK(status)) {
			DEBUG(1,("messaging: Lost message from %s to %s of type %u - %s\n", 
				 cluster_id_string(debug_ctx(), rec->header->from), 
				 cluster_id_string(debug_ctx(), rec->header->to), 
				 rec->header->msg_type, 
				 nt_errstr(status)));
		}
		DLIST_REMOVE(msg->pending, rec);
		talloc_free(rec);
	}
Exemplo n.º 2
0
/* 
   return the path to a messaging socket
*/
static char *messaging_path(struct messaging_context *msg, struct server_id server_id)
{
	TALLOC_CTX *tmp_ctx = talloc_new(msg);
	const char *id = cluster_id_string(tmp_ctx, server_id);
	char *s;
	if (id == NULL) {
		return NULL;
	}
	s = talloc_asprintf(msg, "%s/msg.%s", msg->base_path, id);
	talloc_steal(s, tmp_ctx);
	return s;
}
Exemplo n.º 3
0
/* 
   return the path to a messaging socket
*/
static char *messaging_path(struct messaging_context *msg, struct server_id server_id)
{
	return talloc_asprintf(msg, "%s/msg.%s", msg->base_path, 
			       cluster_id_string(msg, server_id));
}