Changeset 4c6fd56 in mainline for uspace/srv/net/nconfsrv


Ignore:
Timestamp:
2023-09-16T19:58:18Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7d7f5e3
Parents:
6a0b2cc
git-author:
Jiri Svoboda <jiri@…> (2023-09-16 19:48:07)
git-committer:
Jiri Svoboda <jiri@…> (2023-09-16 19:58:18)
Message:

loc_server_register() should be callable more than once (API only)

Now loc_server_register() returns a pointer to a loc_srv_t object,
that is then passed to loc_service_register() and
loc_service_add_to_cat().

Added loc_server_unregister() that unregisters the server
and frees the loc_srv_t object.

Updated all callers. The implementation, however, is a stub.
It is not actually possible to call loc_server_register() more
than once, yet.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/nconfsrv/nconfsrv.c

    r6a0b2cc r4c6fd56  
    11/*
    2  * Copyright (c) 2013 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    5959{
    6060        service_id_t sid;
     61        loc_srv_t *srv;
    6162        errno_t rc;
    6263
     
    7980        async_set_fallback_port_handler(ncs_client_conn, NULL);
    8081
    81         rc = loc_server_register(NAME);
     82        rc = loc_server_register(NAME, &srv);
    8283        if (rc != EOK) {
    8384                log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering server: %s.", str_error(rc));
     
    8586        }
    8687
    87         rc = loc_service_register(SERVICE_NAME_NETCONF, &sid);
     88        rc = loc_service_register(srv, SERVICE_NAME_NETCONF, &sid);
    8889        if (rc != EOK) {
     90                loc_server_unregister(srv);
    8991                log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service: %s.", str_error(rc));
    9092                return EEXIST;
     
    9294
    9395        rc = ncs_link_discovery_start();
    94         if (rc != EOK)
     96        if (rc != EOK) {
     97                loc_service_unregister(srv, sid);
     98                loc_server_unregister(srv);
    9599                return EEXIST;
     100        }
    96101
    97102        return EOK;
Note: See TracChangeset for help on using the changeset viewer.