Changeset 9b1baac in mainline for uspace/srv/locsrv/locsrv.c


Ignore:
Timestamp:
2018-07-18T08:35:42Z (6 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0b05082
Parents:
edc64c0
Message:

ns: register service interfaces individually

Each service interface is now registered individually with the naming
service. This adds a degree of type safety, potentially allows the
individual interfaces to be implemented by independent tasks and moves
the code slightly closer to the full-fledged ports design.

Broker services (e.g. the location service) can still register a
fallback port for receiving connections to all interface types
explicitly using service_register_broker().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/locsrv/locsrv.c

    redc64c0 r9b1baac  
    15331533        }
    15341534
    1535         port_id_t port;
    1536         errno_t rc = async_create_port(INTERFACE_LOC_SUPPLIER,
    1537             loc_connection_supplier, NULL, &port);
     1535        /* Register location service at naming service */
     1536        errno_t rc = service_register(SERVICE_LOC, INTERFACE_LOC_SUPPLIER,
     1537            loc_connection_supplier, NULL);
    15381538        if (rc != EOK) {
    1539                 printf("%s: Error while creating supplier port: %s\n", NAME, str_error(rc));
     1539                printf("%s: Error while registering supplier service: %s\n", NAME, str_error(rc));
    15401540                return rc;
    15411541        }
    15421542
    1543         rc = async_create_port(INTERFACE_LOC_CONSUMER,
    1544             loc_connection_consumer, NULL, &port);
     1543        rc = service_register(SERVICE_LOC, INTERFACE_LOC_CONSUMER,
     1544            loc_connection_consumer, NULL);
    15451545        if (rc != EOK) {
    1546                 printf("%s: Error while creating consumer port: %s\n", NAME, str_error(rc));
     1546                printf("%s: Error while registering consumer service: %s\n", NAME, str_error(rc));
    15471547                return rc;
    15481548        }
    15491549
    1550         /* Set a handler of incomming connections */
    1551         async_set_fallback_port_handler(loc_forward, NULL);
    1552 
    1553         /* Register location service at naming service */
    1554         rc = service_register(SERVICE_LOC);
     1550        rc = service_register_broker(SERVICE_LOC, loc_forward, NULL);
    15551551        if (rc != EOK) {
    1556                 printf("%s: Error while registering service: %s\n", NAME, str_error(rc));
     1552                printf("%s: Error while registering broker service: %s\n", NAME, str_error(rc));
    15571553                return rc;
    15581554        }
Note: See TracChangeset for help on using the changeset viewer.