diff options
-rw-r--r-- | src/ctrl/control_if.c | 41 |
1 files changed, 1 insertions, 40 deletions
diff --git a/src/ctrl/control_if.c b/src/ctrl/control_if.c index d78b513d..de49d160 100644 --- a/src/ctrl/control_if.c +++ b/src/ctrl/control_if.c @@ -388,6 +388,7 @@ struct ctrl_connection *osmo_ctrl_conn_alloc(void *ctx, void *data) ccon->write_queue.bfd.data = data; ccon->write_queue.write_cb = control_write_cb; + ccon->write_queue.read_cb = handle_control_read; return ccon; } @@ -431,7 +432,6 @@ static int listen_fd_cb(struct osmo_fd *listen_bfd, unsigned int what) ccon->write_queue.bfd.fd = fd; ccon->write_queue.bfd.when = BSC_FD_READ; - ccon->write_queue.read_cb = handle_control_read; ret = osmo_fd_register(&ccon->write_queue.bfd); if (ret < 0) { @@ -655,45 +655,6 @@ static int verify_counter(struct ctrl_cmd *cmd, const char *value, void *data) return 0; } -/*! \brief Setup CTRL interface connection to a given address - * \param[in] data Pointer which will be made available to each - set_..() get_..() verify_..() control command function - * \param[in] addr Address to which we shall connect - * \param[in] port Port to which we shall connect - * \param[in] lookup Lookup function pointer, can be NULL - * \returns ctrl_handle pointer or NULL in case of errors - */ -struct ctrl_handle *ctrl_interface_connect(void *data, const char *addr, - uint16_t port, - ctrl_cmd_lookup lookup) -{ - int ret; - struct ctrl_handle *ctrl; - - ctrl = talloc_zero(data, struct ctrl_handle); - if (!ctrl) - return NULL; - - INIT_LLIST_HEAD(&ctrl->ccon_list); - - ctrl->data = data; - ctrl->lookup = lookup; - - ctrl->listen_fd.cb = NULL; - ctrl->listen_fd.data = ctrl; - ret = osmo_sock_init_ofd(&ctrl->listen_fd, AF_INET, SOCK_STREAM, - IPPROTO_TCP, addr, port, OSMO_SOCK_F_CONNECT); - if (ret < 0) { - LOGP(DLCTRL, LOGL_ERROR, "Cannot connect to CTRL at %s:%u\n", - addr, port); - talloc_free(ctrl); - return NULL; - } - LOGP(DLCTRL, LOGL_NOTICE, "CTRL connected to %s:%u\n", addr, port); - - return ctrl; -} - struct ctrl_handle *ctrl_interface_setup(void *data, uint16_t port, ctrl_cmd_lookup lookup) { |