From: Pablo Neira Ayuso <[email protected]>

If no write callback is specified, use the default write callback.
Thus, we don't need to export ipa_client_write_default_cb.

No clients of this function outside libosmo-abis, so no breakages should
be expected.
---
 include/osmocom/abis/ipa.h |    2 --
 src/input/ipa.c            |    6 ++++--
 src/ipa_proxy.c            |    2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/osmocom/abis/ipa.h b/include/osmocom/abis/ipa.h
index fdf4b66..43422dc 100644
--- a/include/osmocom/abis/ipa.h
+++ b/include/osmocom/abis/ipa.h
@@ -57,8 +57,6 @@ struct ipa_client_conn {
 struct ipa_client_conn *ipa_client_conn_create(void *ctx, struct e1inp_ts *ts, 
int priv_nr, const char *addr, uint16_t port, int (*connect)(struct 
ipa_client_conn *link), int (*read_cb)(struct ipa_client_conn *link, struct 
msgb *msgb), int (*write_cb)(struct ipa_client_conn *link), void *data);
 void ipa_client_conn_destroy(struct ipa_client_conn *link);
 
-int ipa_client_write_default_cb(struct ipa_client_conn *link);
-
 int ipa_client_conn_open(struct ipa_client_conn *link);
 void ipa_client_conn_close(struct ipa_client_conn *link);
 
diff --git a/src/input/ipa.c b/src/input/ipa.c
index 020a730..774d578 100644
--- a/src/input/ipa.c
+++ b/src/input/ipa.c
@@ -139,7 +139,7 @@ static void ipa_client_write(struct ipa_client_conn *link)
                link->write_cb(link);
 }
 
-int ipa_client_write_default_cb(struct ipa_client_conn *link)
+static int ipa_client_write_default_cb(struct ipa_client_conn *link)
 {
        struct osmo_fd *ofd = link->ofd;
        struct msgb *msg;
@@ -244,7 +244,9 @@ ipa_client_conn_create(void *ctx, struct e1inp_ts *ts,
        ipa_link->port = port;
        ipa_link->connect_cb = connect_cb;
        ipa_link->read_cb = read_cb;
-       ipa_link->write_cb = write_cb;
+       /* default to generic write callback if not set. */
+       if (write_cb == NULL)
+               ipa_link->write_cb = ipa_client_write_default_cb;
        ipa_link->line = ts->line;
        ipa_link->data = data;
        INIT_LLIST_HEAD(&ipa_link->tx_queue);
diff --git a/src/ipa_proxy.c b/src/ipa_proxy.c
index 6f2525a..f4e1df8 100644
--- a/src/ipa_proxy.c
+++ b/src/ipa_proxy.c
@@ -190,7 +190,7 @@ ipa_sock_src_accept_cb(struct ipa_server_link *link, int fd)
                                           route->shared->dst.inst->net.port,
                                           NULL,
                                           ipa_sock_dst_cb,
-                                          ipa_client_write_default_cb,
+                                          NULL,
                                           conn);
        if (conn->dst == NULL) {
                LOGP(DLINP, LOGL_ERROR, "could not create client: %s\n",
-- 
1.7.2.5


Reply via email to