Only read one record at a time in sptps_receive_data().
sptps_receive_data() always consumes the entire buffer passed to it, which is somewhat inflexible. This commit improves the interface so that sptps_receive_data() consumes at most one record. The goal is to allow non-SPTPS stuff to be interleaved with SPTPS records in a single TCP stream.
This commit is contained in:
parent
de14308840
commit
d237efd325
3 changed files with 76 additions and 68 deletions
10
src/meta.c
10
src/meta.c
|
|
@ -159,8 +159,14 @@ bool receive_meta(connection_t *c) {
|
|||
}
|
||||
|
||||
do {
|
||||
if(c->protocol_minor >= 2)
|
||||
return sptps_receive_data(&c->sptps, bufp, inlen);
|
||||
if(c->protocol_minor >= 2) {
|
||||
int len = sptps_receive_data(&c->sptps, bufp, inlen);
|
||||
if(!len)
|
||||
return false;
|
||||
bufp += len;
|
||||
inlen -= len;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!c->status.decryptin) {
|
||||
endp = memchr(bufp, '\n', inlen);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue