1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 09:27:59 +00:00

Put an optional IdempotentCallback in bufchains.

The callback has the same semantics as for packet queues: it triggers
automatically when data is added to a bufchain, not when it's removed.
This commit is contained in:
Simon Tatham 2018-09-22 08:13:41 +01:00
parent 623c7b720c
commit 06b721ca03
6 changed files with 14 additions and 2 deletions

View File

@ -126,6 +126,10 @@ char *x_get_default(const char *key)
void sk_cleanup(void)
{
}
void queue_idempotent_callback(IdempotentCallback *ic)
{
assert(0);
}
void showversion(void)
{

4
misc.c
View File

@ -707,6 +707,7 @@ void bufchain_init(bufchain *ch)
{
ch->head = ch->tail = NULL;
ch->buffersize = 0;
ch->ic = NULL;
}
void bufchain_clear(bufchain *ch)
@ -758,6 +759,9 @@ void bufchain_add(bufchain *ch, const void *data, int len)
ch->tail = newbuf;
}
}
if (ch->ic)
queue_idempotent_callback(ch->ic);
}
void bufchain_consume(bufchain *ch, int len)

1
misc.h
View File

@ -78,6 +78,7 @@ struct bufchain_granule;
struct bufchain_tag {
struct bufchain_granule *head, *tail;
int buffersize; /* current amount of buffered data */
IdempotentCallback *ic;
};
void bufchain_init(bufchain *ch);

View File

@ -33,6 +33,7 @@ int random_byte(void)
}
void logevent(Frontend *frontend, const char *msg) { assert(0); }
void queue_idempotent_callback(IdempotentCallback *ic) { assert(0); }
#define fromxdigit(c) ( (c)>'9' ? ((c)&0xDF) - 'A' + 10 : (c) - '0' )

View File

@ -60,8 +60,9 @@ void nonfatal(const char *fmt, ...)
sfree(stuff);
}
/* Stub needed to link against misc.c */
/* Stubs needed to link against misc.c */
void logevent(Frontend *frontend, const char *msg) { assert(0); }
void queue_idempotent_callback(IdempotentCallback *ic) { assert(0); }
/* ----------------------------------------------------------------------
* Progress report code. This is really horrible :-)

View File

@ -113,8 +113,9 @@ static void unmungestr(char *in, char *out, int outlen)
return;
}
/* Stub needed to link against misc.c */
/* Stubs needed to link against misc.c */
void logevent(Frontend *frontend, const char *msg) { assert(0); }
void queue_idempotent_callback(IdempotentCallback *ic) { assert(0); }
static int has_security;