mirror of
https://gitea.invidious.io/iv-org/litespeed-quic.git
synced 2024-08-15 00:53:43 +00:00
Latest changes
- Fix unit test regression: enable them correctly in cmake. - Simplify connection has interface
This commit is contained in:
parent
bfc7bfd842
commit
7fbe101b9c
7 changed files with 27 additions and 36 deletions
|
@ -1,3 +1,7 @@
|
|||
2018-02-28
|
||||
- Fix unit test regression: enable them correctly in cmake.
|
||||
- Simplify connection has interface
|
||||
|
||||
2018-02-26
|
||||
- [API Change] lsquic_engine_connect() returns pointer to the connection
|
||||
object.
|
||||
|
|
|
@ -93,5 +93,12 @@ add_subdirectory(src)
|
|||
|
||||
add_subdirectory(test)
|
||||
|
||||
IF(DEVEL_MODE EQUAL 1)
|
||||
# Our test framework relies on assertions, only compile if assertions are
|
||||
# enabled.
|
||||
#
|
||||
enable_testing()
|
||||
ENDIF()
|
||||
|
||||
|
||||
ADD_CUSTOM_TARGET(docs doxygen dox.cfg)
|
||||
|
|
|
@ -75,7 +75,7 @@ enum lsquic_version
|
|||
};
|
||||
|
||||
/**
|
||||
* We currently support versions 35, 37, 38, 39, and 40.
|
||||
* We currently support versions 35, 37, 38, 39, and 41.
|
||||
* @see lsquic_version
|
||||
*/
|
||||
#define LSQUIC_SUPPORTED_VERSIONS ((1 << LSQVER_035) | (1 << LSQVER_037) | \
|
||||
|
|
|
@ -50,7 +50,7 @@ conn_hash_cleanup (struct conn_hash *conn_hash)
|
|||
|
||||
|
||||
struct lsquic_conn *
|
||||
conn_hash_find (struct conn_hash *conn_hash, lsquic_cid_t cid, unsigned *hashp)
|
||||
conn_hash_find (struct conn_hash *conn_hash, lsquic_cid_t cid)
|
||||
{
|
||||
const unsigned hash = XXH32(&cid, sizeof(cid), (uintptr_t) conn_hash);
|
||||
const unsigned buckno = conn_hash_bucket_no(conn_hash, hash);
|
||||
|
@ -58,8 +58,6 @@ conn_hash_find (struct conn_hash *conn_hash, lsquic_cid_t cid, unsigned *hashp)
|
|||
TAILQ_FOREACH(lconn, &conn_hash->ch_buckets[buckno], cn_next_hash)
|
||||
if (lconn->cn_cid == cid)
|
||||
return lconn;
|
||||
if (hashp)
|
||||
*hashp = hash;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -103,11 +101,10 @@ double_conn_hash_buckets (struct conn_hash *conn_hash)
|
|||
|
||||
|
||||
int
|
||||
conn_hash_add (struct conn_hash *conn_hash, struct lsquic_conn *lconn,
|
||||
unsigned hash)
|
||||
conn_hash_add (struct conn_hash *conn_hash, struct lsquic_conn *lconn)
|
||||
{
|
||||
assert(hash == XXH32(&lconn->cn_cid, sizeof(lconn->cn_cid),
|
||||
(uintptr_t) conn_hash));
|
||||
const unsigned hash = XXH32(&lconn->cn_cid, sizeof(lconn->cn_cid),
|
||||
(uintptr_t) conn_hash);
|
||||
if (conn_hash->ch_count >= conn_hash->ch_max_count)
|
||||
return -1;
|
||||
if (conn_hash->ch_count >=
|
||||
|
@ -126,16 +123,6 @@ conn_hash_add (struct conn_hash *conn_hash, struct lsquic_conn *lconn,
|
|||
}
|
||||
|
||||
|
||||
int
|
||||
conn_hash_add_new (struct conn_hash *conn_hash, struct lsquic_conn *lconn)
|
||||
{
|
||||
unsigned hash_val;
|
||||
hash_val = XXH32(&lconn->cn_cid, sizeof(lconn->cn_cid),
|
||||
(uintptr_t) conn_hash);
|
||||
return conn_hash_add(conn_hash, lconn, hash_val);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
conn_hash_remove (struct conn_hash *conn_hash, struct lsquic_conn *lconn)
|
||||
{
|
||||
|
|
|
@ -38,19 +38,12 @@ conn_hash_init (struct conn_hash *, unsigned max_count);
|
|||
void
|
||||
conn_hash_cleanup (struct conn_hash *);
|
||||
|
||||
/* If entry is not found, `hash' is set. Use it as argument to conn_hash_add.
|
||||
* `hash' may be NULL.
|
||||
*/
|
||||
struct lsquic_conn *
|
||||
conn_hash_find (struct conn_hash *conn_hash, lsquic_cid_t cid, unsigned *hash);
|
||||
conn_hash_find (struct conn_hash *conn_hash, lsquic_cid_t);
|
||||
|
||||
/* Returns -1 if limit has been reached or if malloc fails */
|
||||
int
|
||||
conn_hash_add (struct conn_hash *, struct lsquic_conn *, unsigned hash);
|
||||
|
||||
/* Returns -1 if limit has been reached or if malloc fails */
|
||||
int
|
||||
conn_hash_add_new (struct conn_hash *, struct lsquic_conn *);
|
||||
conn_hash_add (struct conn_hash *, struct lsquic_conn *);
|
||||
|
||||
void
|
||||
conn_hash_remove (struct conn_hash *, struct lsquic_conn *);
|
||||
|
|
|
@ -492,7 +492,7 @@ new_full_conn_client (lsquic_engine_t *engine, const char *hostname,
|
|||
engine->stream_if_ctx, flags, hostname, max_packet_size);
|
||||
if (!conn)
|
||||
return NULL;
|
||||
if (0 != conn_hash_add_new(&engine->full_conns, conn))
|
||||
if (0 != conn_hash_add(&engine->full_conns, conn))
|
||||
{
|
||||
LSQ_WARN("cannot add connection %"PRIu64" to hash - destroy",
|
||||
conn->cn_cid);
|
||||
|
@ -529,7 +529,7 @@ find_or_create_conn (lsquic_engine_t *engine, lsquic_packet_in_t *packet_in,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
conn = conn_hash_find(&engine->full_conns, packet_in->pi_conn_id, NULL);
|
||||
conn = conn_hash_find(&engine->full_conns, packet_in->pi_conn_id);
|
||||
if (conn)
|
||||
{
|
||||
conn->cn_pf->pf_parse_packet_in_finish(packet_in, ppstate);
|
||||
|
|
|
@ -33,7 +33,7 @@ main (int argc, char **argv)
|
|||
{
|
||||
struct malo *malo;
|
||||
struct conn_hash conn_hash;
|
||||
unsigned n, hash, nelems;
|
||||
unsigned n, nelems;
|
||||
struct lsquic_conn *lconn, *find_lsconn;
|
||||
int s;
|
||||
|
||||
|
@ -53,9 +53,9 @@ main (int argc, char **argv)
|
|||
{
|
||||
lconn = get_new_lsquic_conn(malo);
|
||||
lconn->cn_if = (void *) (uintptr_t) n; /* This will be used for verification later the test */
|
||||
find_lsconn = conn_hash_find(&conn_hash, lconn->cn_cid, &hash);
|
||||
find_lsconn = conn_hash_find(&conn_hash, lconn->cn_cid);
|
||||
assert(!find_lsconn);
|
||||
s = conn_hash_add(&conn_hash, lconn, hash);
|
||||
s = conn_hash_add(&conn_hash, lconn);
|
||||
assert(0 == s);
|
||||
}
|
||||
|
||||
|
@ -63,9 +63,9 @@ main (int argc, char **argv)
|
|||
|
||||
{
|
||||
lconn = get_new_lsquic_conn(malo);
|
||||
find_lsconn = conn_hash_find(&conn_hash, lconn->cn_cid, &hash);
|
||||
find_lsconn = conn_hash_find(&conn_hash, lconn->cn_cid);
|
||||
assert(!find_lsconn);
|
||||
s = conn_hash_add(&conn_hash, lconn, hash);
|
||||
s = conn_hash_add(&conn_hash, lconn);
|
||||
assert(-1 == s);
|
||||
lsquic_malo_put(lconn);
|
||||
}
|
||||
|
@ -76,10 +76,10 @@ main (int argc, char **argv)
|
|||
for (lconn = lsquic_malo_first(malo); lconn;
|
||||
lconn = lsquic_malo_next(malo))
|
||||
{
|
||||
find_lsconn = conn_hash_find(&conn_hash, lconn->cn_cid, &hash);
|
||||
find_lsconn = conn_hash_find(&conn_hash, lconn->cn_cid);
|
||||
assert(find_lsconn == lconn);
|
||||
conn_hash_remove(&conn_hash, lconn);
|
||||
find_lsconn = conn_hash_find(&conn_hash, lconn->cn_cid, &hash);
|
||||
find_lsconn = conn_hash_find(&conn_hash, lconn->cn_cid);
|
||||
assert(!find_lsconn);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue