Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/hound/src/protocol.c

    rfafb8e5 rca48672  
    11/*
     2 * Copyright (c) 2025 Jiri Svoboda
    23 * Copyright (c) 2012 Jan Vesely
    34 * All rights reserved.
     
    8485const char *HOUND_SERVICE = "audio/hound";
    8586
     87/** Server object */
     88static loc_srv_t *hound_srv;
     89
    8690/**
    8791 * Start a new audio session.
     
    394398        void *sink;
    395399
    396         /* Accept connection if there is a valid iface*/
     400        /* Accept connection if there is a valid iface */
    397401        if (server_iface) {
    398402                async_accept_0(icall);
     
    547551                        ret = async_data_write_accept(&source, true, 0, 0, 0,
    548552                            0);
    549                         /*read sink name */
     553                        /* read sink name */
    550554                        if (ret == EOK)
    551555                                ret = async_data_write_accept(&sink,
     
    611615                case IPC_M_HOUND_STREAM_EXIT:
    612616                case IPC_M_HOUND_STREAM_DRAIN:
    613                         /* Stream exit/drain is only allowed in stream context*/
     617                        /* Stream exit/drain is only allowed in stream context */
    614618                        async_answer_0(&call, EINVAL);
    615619                        break;
     
    730734errno_t hound_server_register(const char *name, service_id_t *id)
    731735{
     736        errno_t rc;
     737
    732738        if (!name || !id)
    733739                return EINVAL;
    734740
    735         errno_t ret = loc_server_register(name);
    736         if (ret != EOK)
    737                 return ret;
    738 
    739         return loc_service_register(HOUND_SERVICE, id);
     741        if (hound_srv != NULL)
     742                return EBUSY;
     743
     744        rc = loc_server_register(name, &hound_srv);
     745        if (rc != EOK)
     746                return rc;
     747
     748        rc = loc_service_register(hound_srv, HOUND_SERVICE,
     749            fallback_port_id, id);
     750        if (rc != EOK) {
     751                loc_server_unregister(hound_srv);
     752                return rc;
     753        }
     754
     755        return EOK;
    740756}
    741757
     
    746762void hound_server_unregister(service_id_t id)
    747763{
    748         loc_service_unregister(id);
     764        loc_service_unregister(hound_srv, id);
     765        loc_server_unregister(hound_srv);
    749766}
    750767
Note: See TracChangeset for help on using the changeset viewer.