gsmtap: deal with apps that call gsmtap_send*() with NULL gsmtap_inst

This commit is contained in:
Harald Welte 2011-05-22 20:06:11 +02:00
parent b62b04bbf3
commit 13692a6bd3
1 changed files with 6 additions and 0 deletions

View File

@ -148,6 +148,9 @@ int gsmtap_source_add_sink_fd(int gsmtap_fd)
int gsmtap_sendmsg(struct gsmtap_inst *gti, struct msgb *msg)
{
if (!gti)
return -ENODEV;
if (gti->ofd_wq_mode)
return osmo_wqueue_enqueue(&gti->wq, msg);
else {
@ -175,6 +178,9 @@ int gsmtap_send(struct gsmtap_inst *gti, uint16_t arfcn, uint8_t ts,
{
struct msgb *msg;
if (!gti)
return -ENODEV;
msg = gsmtap_makemsg(arfcn, ts, chan_type, ss, fn, signal_dbm,
snr, data, len);
if (!msg)