VIRT-PHY: cause BTS to terminate in case of recv()/send() on udp socket returns 0
It is important that we reliably terminate the BTS in case any of the VirtPHY multicast sockets dies for whatever reason. Change-Id: I5ae3fdd7cc35fdf235550a3b8362020fdd287c13
This commit is contained in:
parent
e3b8279f26
commit
576408b651
|
@ -66,6 +66,13 @@ static struct phy_instance *phy_instance_by_arfcn(struct phy_link *plink, uint16
|
|||
static void virt_um_rcv_cb(struct virt_um_inst *vui, struct msgb *msg)
|
||||
{
|
||||
struct phy_link *plink = (struct phy_link *)vui->priv;
|
||||
struct phy_instance *pinst;
|
||||
if (!msg) {
|
||||
pinst = phy_instance_by_num(plink, 0);
|
||||
bts_shutdown(pinst->trx->bts, "VirtPHY read socket died\n");
|
||||
return;
|
||||
}
|
||||
|
||||
struct gsmtap_hdr *gh = msgb_l1(msg);
|
||||
uint32_t fn = ntohl(gh->frame_number); /* frame number of the rcv msg */
|
||||
uint16_t arfcn = ntohs(gh->arfcn); /* arfcn of the cell we currently camp on */
|
||||
|
@ -77,7 +84,6 @@ static void virt_um_rcv_cb(struct virt_um_inst *vui, struct msgb *msg)
|
|||
uint8_t rsl_chantype; /* rsl chan type (8.58, 9.3.1) */
|
||||
uint8_t link_id; /* rsl link id tells if this is an ssociated or dedicated link */
|
||||
uint8_t chan_nr; /* encoded rsl channel type, timeslot and mf subslot */
|
||||
struct phy_instance *pinst;
|
||||
struct osmo_phsap_prim l1sap;
|
||||
|
||||
memset(&l1sap, 0, sizeof(l1sap));
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <osmo-bts/phy_link.h>
|
||||
#include <osmo-bts/logging.h>
|
||||
#include <osmo-bts/rsl.h>
|
||||
#include <osmo-bts/bts.h>
|
||||
#include <osmo-bts/l1sap.h>
|
||||
#include <osmo-bts/amr.h>
|
||||
#include <osmo-bts/scheduler.h>
|
||||
|
@ -93,9 +94,13 @@ static void tx_to_virt_um(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
|
|||
if (outmsg) {
|
||||
struct phy_instance *pinst = trx_phy_instance(l1t->trx);
|
||||
struct gsmtap_hdr *gh = (struct gsmtap_hdr *)msgb_data(outmsg);
|
||||
int rc;
|
||||
|
||||
if (virt_um_write_msg(pinst->phy_link->u.virt.virt_um, outmsg) == -1)
|
||||
rc = virt_um_write_msg(pinst->phy_link->u.virt.virt_um, outmsg);
|
||||
if (rc < 0)
|
||||
LOGP(DL1P, LOGL_ERROR, "%s GSMTAP msg could not send to virtual Um\n", gsmtap_hdr_stringify(gh));
|
||||
else if (rc == 0)
|
||||
bts_shutdown(l1t->trx->bts, "VirtPHY write socket died\n");
|
||||
else
|
||||
DEBUGP(DL1C, "%s Sending GSMTAP message to virtual Um\n", gsmtap_hdr_stringify(gh));
|
||||
} else
|
||||
|
|
|
@ -48,11 +48,12 @@ static int virt_um_fd_cb(struct osmo_fd *ofd, unsigned int what)
|
|||
msg->l1h = msgb_data(msg);
|
||||
/* call the l1 callback function for a received msg */
|
||||
vui->recv_cb(vui, msg);
|
||||
} else {
|
||||
/* FIXME: this kind of error handling might be a bit harsh */
|
||||
} else if (rc == 0) {
|
||||
vui->recv_cb(vui, NULL);
|
||||
osmo_fd_close(ofd);
|
||||
}
|
||||
} else
|
||||
perror("Read from multicast socket");
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -86,6 +87,8 @@ int virt_um_write_msg(struct virt_um_inst *vui, struct msgb *msg)
|
|||
|
||||
rc = mcast_bidir_sock_tx(vui->mcast_sock, msgb_data(msg),
|
||||
msgb_length(msg));
|
||||
if (rc < 0)
|
||||
perror("Writing to multicast socket");
|
||||
msgb_free(msg);
|
||||
|
||||
return rc;
|
||||
|
|
Loading…
Reference in New Issue