83 static void scache_single_expire_endp(
int,
void *);
84 static void scache_single_expire_dest(
int,
void *);
86 #define SCACHE_SINGLE_ENDP_BUSY(sp) (VSTRING_LEN(sp->endp.endp_label) > 0)
87 #define SCACHE_SINGLE_DEST_BUSY(sp) (VSTRING_LEN(sp->dest.dest_label) > 0)
89 #define STR(x) vstring_str(x)
95 const char *myname =
"scache_single_free_endp";
112 static void scache_single_expire_endp(
int unused_event,
void *context)
116 scache_single_free_endp(sp);
121 static void scache_single_save_endp(
SCACHE *scache,
int endp_ttl,
122 const char *endp_label,
123 const char *endp_prop,
int fd)
126 const char *myname =
"scache_single_save_endp";
129 msg_panic(
"%s: bad endp_ttl: %d", myname, endp_ttl);
132 scache_single_free_endp(sp);
140 msg_info(
"%s: %s fd=%d", myname, endp_label, fd);
145 static int scache_single_find_endp(
SCACHE *scache,
const char *endp_label,
149 const char *myname =
"scache_single_find_endp";
154 msg_info(
"%s: no endpoint cache: %s", myname, endp_label);
161 scache_single_free_endp(sp);
163 msg_info(
"%s: found: %s fd=%d", myname, endp_label, fd);
167 msg_info(
"%s: not found: %s", myname, endp_label);
175 const char *myname =
"scache_single_free_dest";
192 static void scache_single_expire_dest(
int unused_event,
void *context)
196 scache_single_free_dest(sp);
201 static void scache_single_save_dest(
SCACHE *scache,
int dest_ttl,
202 const char *dest_label,
203 const char *dest_prop,
204 const char *endp_label)
207 const char *myname =
"scache_single_save_dest";
211 msg_panic(
"%s: bad dest_ttl: %d", myname, dest_ttl);
230 msg_info(
"%s: %s -> %s%s", myname, dest_label, endp_label,
231 refresh ?
" (refreshed)" :
"");
236 static int scache_single_find_dest(
SCACHE *scache,
const char *dest_label,
240 const char *myname =
"scache_single_find_dest";
245 msg_info(
"%s: no destination cache: %s", myname, dest_label);
250 msg_info(
"%s: found: %s", myname, dest_label);
251 if ((fd = scache_single_find_endp(scache,
STR(sp->
dest.
endp_label), endp_prop)) >= 0) {
257 msg_info(
"%s: not found: %s", myname, dest_label);
274 static void scache_single_free(
SCACHE *scache)
#define SCACHE_SINGLE_DEST_BUSY(sp)
void(* size)(struct SCACHE *, SCACHE_SIZE *)
NORETURN msg_panic(const char *fmt,...)
#define SCACHE_SINGLE_ENDP_BUSY(sp)
SCACHE * scache_single_create(void)
SCACHE_FIND_DEST_FN find_dest
VSTRING * vstring_strcpy(VSTRING *vp, const char *src)
#define VSTRING_TERMINATE(vp)
#define VSTRING_RESET(vp)
void msg_warn(const char *fmt,...)
VSTRING * vstring_alloc(ssize_t len)
SCACHE_SAVE_ENDP_FN save_endp
SCACHE_SAVE_DEST_FN save_dest
SCACHE_FIND_ENDP_FN find_endp
VSTRING * vstring_free(VSTRING *vp)
time_t event_request_timer(EVENT_NOTIFY_TIME_FN callback, void *context, int delay)
void(* free)(struct SCACHE *)
int event_cancel_timer(EVENT_NOTIFY_TIME_FN callback, void *context)
void * mymalloc(ssize_t len)
void msg_info(const char *fmt,...)