struct comm_notify_list *notify = &cc->notify;
struct comm_notify_entry *n;
+ priomsg_reset(&cc->why_unwanted);
+
LIST_FOREACH(n, notify, entry) {
- if (n->fn(n->state, buf, ca)) {
+ if (n->fn(n->state, buf, ca, &cc->why_unwanted)) {
return True;
}
}
cc->ops.release_notify=comm_release_notify;
LIST_INIT(&cc->notify);
cc->rbuf=NULL;
+ priomsg_new(&cc->why_unwanted, MAX_NAK_MSG);
}
struct cloc loc;
struct comm_notify_list notify;
struct buffer_if *rbuf;
+ struct priomsg why_unwanted;
};
struct comm_clientinfo *comm_clientinfo_ignore(void *state, dict_t*,
bool_t comm_notify(struct commcommon*, struct buffer_if *buf,
const struct comm_addr *ca);
/* Either: returns True, with message delivered and buffer freed.
- * Or: False, if no-one wanted it - buffer still allocd'd.
- * Ie, like comm_notify_fn. */
+ * Or: False, if no-one wanted it - buffer still allocd'd;
+ * in that case, cc->why_unwanted has info
+ * Ie, roughly like comm_notify_fn. */
void comm_apply(struct commcommon *cc, void *st);
#define MAX_PEER_ADDRS 5
/* send at most this many copies; honour at most that many addresses */
+#define MAX_NAK_MSG 80
+
struct hash_if;
struct comm_if;
struct comm_addr;
+struct priomsg;
typedef char *string_t;
typedef const char *cstring_t;
/* Return True if the packet was processed, and shouldn't be passed to
any other potential receivers. (buf is freed iff True returned.) */
typedef bool_t comm_notify_fn(void *state, struct buffer_if *buf,
- const struct comm_addr *source);
+ const struct comm_addr *source,
+ struct priomsg *whynot);
typedef void comm_request_notify_fn(void *commst, void *nst,
comm_notify_fn *fn);
typedef void comm_release_notify_fn(void *commst, void *nst,
this current site instance (and should therefore not be processed
by other sites), even if the packet was otherwise ignored. */
static bool_t site_incoming(void *sst, struct buffer_if *buf,
- const struct comm_addr *source)
+ const struct comm_addr *source,
+ struct priomsg *whynot)
{
struct site *st=sst;