Reduce mk_cam encoding calls
This commit is contained in:
parent
2a9bf03d67
commit
2d1696548a
16
src/cam.c
16
src/cam.c
|
|
@ -86,7 +86,7 @@ static int permissions_check(int cid, uint8_t* permissions, uint8_t permissions_
|
|||
|
||||
}
|
||||
|
||||
static int mk_cam(facilities_t* facilities, uint8_t *cam_oer, uint32_t *cam_len, uint8_t *fi_oer, uint32_t *fi_len) {
|
||||
static int mk_cam(facilities_t* facilities, uint8_t *cam_oer, uint32_t *cam_len) {
|
||||
int rv = 0;
|
||||
|
||||
CAM_t *cam = calloc(1, sizeof(CAM_t));
|
||||
|
|
@ -290,15 +290,6 @@ static int mk_cam(facilities_t* facilities, uint8_t *cam_oer, uint32_t *cam_len,
|
|||
}
|
||||
*cam_len = (enc.encoded + 7) / 8;
|
||||
|
||||
asn_enc_rval_t retval_enc_fi = uper_encode_to_buffer(&asn_DEF_CAM, NULL, cam, fi_oer, 512);
|
||||
if (retval_enc_fi.encoded == -1) {
|
||||
syslog_err("[facilities] [ca] failed encoding CAM (%s)", retval_enc_fi.failed_type->name);
|
||||
rv = 1;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
*fi_len = ((retval_enc_fi.encoded + 7) / 8);
|
||||
|
||||
cleanup:
|
||||
ASN_STRUCT_FREE(asn_DEF_CAM, cam);
|
||||
|
||||
|
|
@ -687,10 +678,12 @@ void *ca_service(void *fc) {
|
|||
usleep(1000*50);
|
||||
|
||||
if (lightship_check(facilities->lightship, &facilities->epv) && facilities->lightship->active) {
|
||||
rv = mk_cam(facilities, bpr->data.buf, (uint32_t *) &bpr->data.size, fmi->data.buf, (uint32_t *) &fmi->data.size);
|
||||
rv = mk_cam(facilities, bpr->data.buf, (uint32_t *) &bpr->data.size);
|
||||
if (rv) {
|
||||
continue;
|
||||
}
|
||||
memcpy(fmi->data.buf, bpr->data.buf, bpr->data.size);
|
||||
fmi->data.size = bpr->data.size;
|
||||
|
||||
// Check if inside PZ
|
||||
bpr->gn.communicationProfile = 0;
|
||||
|
|
@ -712,7 +705,6 @@ void *ca_service(void *fc) {
|
|||
queue_add(facilities->tx_queue, tr_oer, enc.encoded+1, 3);
|
||||
pthread_cond_signal(&facilities->tx_queue->trigger);
|
||||
|
||||
|
||||
queue_add(facilities->tx_queue, fi_oer, enc_fdi.encoded+1, 5);
|
||||
pthread_cond_signal(&facilities->tx_queue->trigger);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue