Propagate error to caller when tx cbsp/sbcap Write-Replace-Req fails
Change-Id: Ie40c8e41c297398bbec48f7bb2c60cfdc703fa5dchanges/53/28853/1
parent
0b8a08b698
commit
e86af042fd
|
@ -47,6 +47,6 @@ struct cbc_cbsp_link *cbc_cbsp_link_alloc(struct cbc_cbsp_mgr *cbc, struct cbc_p
|
|||
void cbc_cbsp_link_free(struct cbc_cbsp_link *link);
|
||||
const char *cbc_cbsp_link_name(const struct cbc_cbsp_link *link);
|
||||
int cbc_cbsp_link_open_cli(struct cbc_cbsp_link *link);
|
||||
void cbc_cbsp_link_tx(struct cbc_cbsp_link *link, struct osmo_cbsp_decoded *cbsp);
|
||||
int cbc_cbsp_link_tx(struct cbc_cbsp_link *link, struct osmo_cbsp_decoded *cbsp);
|
||||
void cbc_cbsp_link_close(struct cbc_cbsp_link *link);
|
||||
int cbc_cbsp_link_rx_cb(struct cbc_cbsp_link *link, struct osmo_cbsp_decoded *dec);
|
||||
|
|
|
@ -47,6 +47,6 @@ struct cbc_sbcap_link *cbc_sbcap_link_alloc(struct cbc_sbcap_mgr *cbc, struct cb
|
|||
void cbc_sbcap_link_free(struct cbc_sbcap_link *link);
|
||||
const char *cbc_sbcap_link_name(const struct cbc_sbcap_link *link);
|
||||
int cbc_sbcap_link_open_cli(struct cbc_sbcap_link *link);
|
||||
void cbc_sbcap_link_tx(struct cbc_sbcap_link *link, SBcAP_SBC_AP_PDU_t *pdu);
|
||||
int cbc_sbcap_link_tx(struct cbc_sbcap_link *link, SBcAP_SBC_AP_PDU_t *pdu);
|
||||
void cbc_sbcap_link_close(struct cbc_sbcap_link *link);
|
||||
int cbc_sbcap_link_rx_cb(struct cbc_sbcap_link *link, SBcAP_SBC_AP_PDU_t *pdu);
|
||||
|
|
|
@ -70,8 +70,8 @@ int peer_new_cbc_message(struct cbc_peer *peer, struct cbc_message *cbcmsg)
|
|||
peer->name);
|
||||
return -EINVAL;
|
||||
}
|
||||
cbc_cbsp_link_tx(peer->link.cbsp, cbsp);
|
||||
break;
|
||||
return cbc_cbsp_link_tx(peer->link.cbsp, cbsp);
|
||||
|
||||
case CBC_PEER_PROTO_SBcAP:
|
||||
/* skip peers without any current SBc-AP connection */
|
||||
if (!peer->link.sbcap) {
|
||||
|
@ -84,17 +84,16 @@ int peer_new_cbc_message(struct cbc_peer *peer, struct cbc_message *cbcmsg)
|
|||
peer->name);
|
||||
return -EINVAL;
|
||||
}
|
||||
cbc_sbcap_link_tx(peer->link.sbcap, sbcap);
|
||||
break;
|
||||
return cbc_sbcap_link_tx(peer->link.sbcap, sbcap);
|
||||
|
||||
case CBC_PEER_PROTO_SABP:
|
||||
LOGP(DLGLOBAL, LOGL_ERROR, "Sending message to peer proto %s not implemented!\n",
|
||||
get_value_string(cbc_peer_proto_name, peer->proto));
|
||||
return -1;
|
||||
|
||||
default:
|
||||
OSMO_ASSERT(0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* receive a new CBC message from the user (REST). Allocates new memory,
|
||||
|
|
|
@ -318,14 +318,14 @@ static int cbsp_cbc_accept_cb(struct osmo_stream_srv_link *srv_link, int fd)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void cbc_cbsp_link_tx(struct cbc_cbsp_link *link, struct osmo_cbsp_decoded *cbsp)
|
||||
int cbc_cbsp_link_tx(struct cbc_cbsp_link *link, struct osmo_cbsp_decoded *cbsp)
|
||||
{
|
||||
struct msgb *msg;
|
||||
|
||||
if (!link) {
|
||||
LOGP(DCBSP, LOGL_NOTICE, "Cannot transmit %s: no connection\n",
|
||||
get_value_string(cbsp_msg_type_names, cbsp->msg_type));
|
||||
return ;
|
||||
return -ENOLINK;
|
||||
}
|
||||
|
||||
LOGPCC(link, LOGL_INFO, "Transmitting %s\n",
|
||||
|
@ -336,13 +336,14 @@ void cbc_cbsp_link_tx(struct cbc_cbsp_link *link, struct osmo_cbsp_decoded *cbsp
|
|||
LOGPCC(link, LOGL_ERROR, "Failed to encode CBSP %s: %s\n",
|
||||
get_value_string(cbsp_msg_type_names, cbsp->msg_type), osmo_cbsp_errstr);
|
||||
talloc_free(cbsp);
|
||||
return;
|
||||
return -EINVAL;
|
||||
}
|
||||
talloc_free(cbsp);
|
||||
if (link->is_client)
|
||||
osmo_stream_cli_send(link->cli_conn, msg);
|
||||
else
|
||||
osmo_stream_srv_send(link->srv_conn, msg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void cbc_cbsp_link_close(struct cbc_cbsp_link *link)
|
||||
|
|
|
@ -379,27 +379,30 @@ static int sbcap_cbc_accept_cb(struct osmo_stream_srv_link *srv_link, int fd)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void cbc_sbcap_link_tx(struct cbc_sbcap_link *link, SBcAP_SBC_AP_PDU_t *pdu)
|
||||
int cbc_sbcap_link_tx(struct cbc_sbcap_link *link, SBcAP_SBC_AP_PDU_t *pdu)
|
||||
{
|
||||
struct msgb *msg;
|
||||
int rc = 0;
|
||||
|
||||
if (!pdu) {
|
||||
LOGP(DSBcAP, LOGL_NOTICE, "Cannot transmit msg: no pdu\n");
|
||||
return;
|
||||
return -ENOMSG;
|
||||
}
|
||||
|
||||
if (!link) {
|
||||
LOGP(DSBcAP, LOGL_NOTICE, "Cannot transmit msg %s: no connection\n",
|
||||
sbcap_pdu_get_name(pdu));
|
||||
return;
|
||||
return -ENOLINK;
|
||||
}
|
||||
|
||||
LOGPSBCAPC(link, LOGL_INFO, "Tx msg %s\n",
|
||||
sbcap_pdu_get_name(pdu));
|
||||
OSMO_ASSERT(link->conn);
|
||||
msg = sbcap_encode(pdu);
|
||||
if (!msg)
|
||||
if (!msg) {
|
||||
rc = -EINVAL;
|
||||
goto ret_free;
|
||||
}
|
||||
LOGPSBCAPC(link, LOGL_DEBUG, "Encoded message %s: %s\n",
|
||||
sbcap_pdu_get_name(pdu), msgb_hexdump(msg));
|
||||
if (link->is_client)
|
||||
|
@ -408,6 +411,7 @@ void cbc_sbcap_link_tx(struct cbc_sbcap_link *link, SBcAP_SBC_AP_PDU_t *pdu)
|
|||
osmo_stream_srv_send(link->srv_conn, msg);
|
||||
ret_free:
|
||||
sbcap_pdu_free(pdu);
|
||||
return rc;
|
||||
}
|
||||
|
||||
void cbc_sbcap_link_close(struct cbc_sbcap_link *link)
|
||||
|
|
Loading…
Reference in New Issue