bankd_main: Improve log usefulness

Right now we get duplicate log lines like

[000 CONN_CLIENT_MAPPED_CARD] bankd_main.c:662 Rx RSPRO tpduModemToCard
[000 CONN_CLIENT_MAPPED_CARD] bankd_main.c:623 tpduModemToCard(0070000001)

Where the first line is printed by the generic receive handler for RSPRO
messages, while the second line is from the specific handler function
handling the specific message type.

Let's only print from the generic message handler if no specific
handler function exists.

Change-Id: I992c847e0081bd1cd8a0b70212618c4980d9db81
This commit is contained in:
Harald Welte 2021-12-08 15:29:28 +01:00
parent 168d72478e
commit 9f7ca61bb5
1 changed files with 6 additions and 5 deletions

View File

@ -645,7 +645,7 @@ static int worker_handle_connectClientReq(struct bankd_worker *worker, const Rsp
OSMO_ASSERT(pdu->msg.present == RsproPDUchoice_PR_connectClientReq);
LOGW(worker, "connectClientReq(T=%lu, N='%s', SW='%s', VER='%s')\n",
LOGW(worker, "Rx RSPRO connectClientReq(T=%lu, N='%s', SW='%s', VER='%s')\n",
cid->type, cid->name.buf, cid->software.buf, cid->swVersion.buf);
/* FIXME: store somewhere? */
@ -698,7 +698,8 @@ static int worker_handle_tpduModemToCard(struct bankd_worker *worker, const Rspr
struct bank_slot bslot;
int rc;
LOGW(worker, "tpduModemToCard(%s)\n", osmo_hexdump_nospc(mdm2sim->data.buf, mdm2sim->data.size));
LOGW(worker, "Rx RSPRO tpduModemToCard(%s)\n",
osmo_hexdump_nospc(mdm2sim->data.buf, mdm2sim->data.size));
if (worker->state != BW_ST_CONN_CLIENT_MAPPED_CARD) {
LOGW(worker, "Unexpected tpduModemToCaard\n");
@ -738,7 +739,7 @@ static int worker_handle_clientSlotStatusInd(struct bankd_worker *worker, const
const struct SlotPhysStatus *sps = &cssi->slotPhysStatus;
int rc = 0;
LOGW(worker, "clientSlotStatusInd(RST=%s, VCC=%s, CLK=%s)\n",
LOGW(worker, "Rx RSPRO clientSlotStatusInd(RST=%s, VCC=%s, CLK=%s)\n",
sps->resetActive ? "ACTIVE" : "INACTIVE",
sps->vccPresent ? *sps->vccPresent ? "PRESENT" : "ABSENT" : "NULL",
sps->clkActive ? *sps->clkActive ? "ACTIVE" : "INACTIVE" : "NULL");
@ -757,8 +758,6 @@ static int worker_handle_rspro(struct bankd_worker *worker, const RsproPDU_t *pd
{
int rc = -100;
LOGW(worker, "Rx RSPRO %s\n", rspro_msgt_name(pdu));
switch (pdu->msg.present) {
case RsproPDUchoice_PR_connectClientReq:
rc = worker_handle_connectClientReq(worker, pdu);
@ -771,9 +770,11 @@ static int worker_handle_rspro(struct bankd_worker *worker, const RsproPDU_t *pd
rc = 0;
break;
case RsproPDUchoice_PR_setAtrRes:
LOGW(worker, "Rx RSPRO %s\n", rspro_msgt_name(pdu));
rc = 0;
break;
default:
LOGW(worker, "Rx RSPRO %s (unhandled)\n", rspro_msgt_name(pdu));
rc = -101;
break;
}