bugfix: avoid a crash when oai_exit is set
There was a crash when we exit the nr softmodem with AW2S device. The array rxbase[] was surely freed() by some other thread, so let's not access it after detecting oai_exit != 0. We also need to unblock a possible reader thread. The chosen way to do may be not the best. To be checked.
This commit is contained in:
@@ -451,6 +451,11 @@ void *udp_read_thread(void *arg) {
|
||||
buffer,sizeof(buffer),0,
|
||||
(struct sockaddr *)&((eth_state_t*)device->priv)->dest_addrd,
|
||||
(socklen_t *)&((eth_state_t*)device->priv)->addr_len);
|
||||
/* if oai_exit is 1 here, don't access the array rxbase,
|
||||
* it may have been freed(), so let's break at this point
|
||||
*/
|
||||
if (oai_exit)
|
||||
break;
|
||||
aid = *(uint16_t*)(&buffer[ECPRICOMMON_BYTES]);
|
||||
TS = *(openair0_timestamp *)(&buffer[ECPRICOMMON_BYTES+ECPRIPCID_BYTES]);
|
||||
// convert TS to samples, /6 for AW2S @ 30.72 Ms/s, this is converted for other sample rates in OAI application
|
||||
@@ -475,6 +480,11 @@ void *udp_read_thread(void *arg) {
|
||||
}
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
/* let's unblock reader (maybe not the best way to do it) */
|
||||
fhstate->first_read = 0;
|
||||
fhstate->r[0] = 1;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user