Logo Search packages:      
Sourcecode: avahi version File versions  Download package

int avahi_s_entry_group_commit ( AvahiSEntryGroup g  ) 

Commit an entry group. This starts the probing and registration process for all RRs in the group

Definition at line 1139 of file entry.c.

References AVAHI_ENTRY_GROUP_COLLISION, AVAHI_ENTRY_GROUP_REGISTERING, AVAHI_ENTRY_GROUP_UNCOMMITED, AVAHI_ERR_BAD_STATE, AVAHI_ERR_IS_EMPTY, and AVAHI_OK.

                                                    {
    struct timeval now;

    assert(g);
    assert(!g->dead);

    if (g->state != AVAHI_ENTRY_GROUP_UNCOMMITED && g->state != AVAHI_ENTRY_GROUP_COLLISION)
        return avahi_server_set_errno(g->server, AVAHI_ERR_BAD_STATE);

    if (avahi_s_entry_group_is_empty(g))
        return avahi_server_set_errno(g->server, AVAHI_ERR_IS_EMPTY);

    g->n_register_try++;

    avahi_timeval_add(&g->register_time,
                      1000*(g->n_register_try >= AVAHI_RR_RATE_LIMIT_COUNT ?
                            AVAHI_RR_HOLDOFF_MSEC_RATE_LIMIT :
                            AVAHI_RR_HOLDOFF_MSEC));

    gettimeofday(&now, NULL);

    if (avahi_timeval_compare(&g->register_time, &now) <= 0) {

        /* Holdoff time passed, so let's start probing */
        entry_group_commit_real(g);
    } else {

         /* Holdoff time has not yet passed, so let's wait */
        assert(!g->register_time_event);
        g->register_time_event = avahi_time_event_new(g->server->time_event_queue, &g->register_time, entry_group_register_time_event_callback, g);

        avahi_s_entry_group_change_state(g, AVAHI_ENTRY_GROUP_REGISTERING);
    }

    return AVAHI_OK;
}


Generated by  Doxygen 1.6.0   Back to index