Fail engine ctor if stream callbackes are not specified

This commit is contained in:
Dmitri Tikhonov 2020-02-20 17:01:15 -05:00
parent 83506617f9
commit df25d34a5e
2 changed files with 7 additions and 0 deletions

View file

@ -470,6 +470,12 @@ lsquic_engine_new (unsigned flags,
return NULL;
}
if (!api->ea_stream_if)
{
LSQ_ERROR("stream interface is not specified");
return NULL;
}
if (api->ea_settings &&
0 != lsquic_engine_check_settings(api->ea_settings, flags,
err_buf, sizeof(err_buf)))

View file

@ -20,6 +20,7 @@ main (void)
memset(&api, 0, sizeof(api));
api.ea_settings = &settings;
api.ea_packets_out = (void *) (uintptr_t) 1;
api.ea_stream_if = (void *) (uintptr_t) 2;
engine = lsquic_engine_new(flags, &api);
assert(engine);