/* Check whether all group members have been probed */
- if (g->status != FLX_ENTRY_GROUP_REGISTERING || g->n_probing > 0)
+ if (g->state != FLX_ENTRY_GROUP_REGISTERING || g->n_probing > 0)
return;
- flx_entry_group_run_callback(g, g->status = FLX_ENTRY_GROUP_ESTABLISHED);
+ flx_entry_group_run_callback(g, g->state = FLX_ENTRY_GROUP_ESTABLISHED);
if (g->dead)
return;
a->entry->group->n_probing--;
}
- if (a->entry->group && a->entry->group->status == FLX_ENTRY_GROUP_REGISTERING)
+ if (a->entry->group && a->entry->group->state == FLX_ENTRY_GROUP_REGISTERING)
a->state = FLX_WAITING;
else {
a->state = FLX_ANNOUNCING;
a->state = FLX_PROBING;
else if (!(e->flags & FLX_ENTRY_NOANNOUNCE)) {
- if (!e->group || e->group->status == FLX_ENTRY_GROUP_ESTABLISHED)
+ if (!e->group || e->group->state == FLX_ENTRY_GROUP_ESTABLISHED)
a->state = FLX_ANNOUNCING;
else
a->state = FLX_WAITING;
FLX_ENTRY_GROUP_REGISTERING,
FLX_ENTRY_GROUP_ESTABLISHED,
FLX_ENTRY_GROUP_COLLISION
-} flxEntryGroupStatus;
+} flxEntryGroupState;
-typedef void (*flxEntryGroupCallback) (flxServer *s, flxEntryGroup *g, flxEntryGroupStatus status, gpointer userdata);
+typedef void (*flxEntryGroupCallback) (flxServer *s, flxEntryGroup *g, flxEntryGroupState state, gpointer userdata);
flxServer *flx_server_new(GMainContext *c);
void flx_server_free(flxServer* s);
flxEntryGroup *flx_entry_group_new(flxServer *s, flxEntryGroupCallback callback, gpointer userdata);
void flx_entry_group_free(flxEntryGroup *g);
void flx_entry_group_commit(flxEntryGroup *g);
-flxEntryGroupStatus flx_entry_group_get_status(flxEntryGroup *g);
+flxEntryGroupState flx_entry_group_get_state(flxEntryGroup *g);
void flx_server_add(
flxServer *s,
g_free(t);
}
-static void entry_group_callback(flxServer *s, flxEntryGroup *g, flxEntryGroupStatus status, gpointer userdata) {
- g_message("entry group state: %i", status);
+static void entry_group_callback(flxServer *s, flxEntryGroup *g, flxEntryGroupState state, gpointer userdata) {
+ g_message("entry group state: %i", state);
}
int main(int argc, char *argv[]) {
flx_interface_monitor_walk(s->monitor, interface, protocol, post_response_callback, &tmpdata);
}
-void flx_entry_group_run_callback(flxEntryGroup *g, flxEntryGroupStatus status) {
+void flx_entry_group_run_callback(flxEntryGroup *g, flxEntryGroupState state) {
g_assert(g);
if (g->callback) {
- g->callback(g->server, g, status, g->userdata);
+ g->callback(g->server, g, state, g->userdata);
return;
}
- if (status == FLX_ENTRY_GROUP_COLLISION)
+ if (state == FLX_ENTRY_GROUP_COLLISION)
flx_entry_group_free(g);
/* Ignore the rest */
g->callback = callback;
g->userdata = userdata;
g->dead = FALSE;
- g->status = FLX_ENTRY_GROUP_UNCOMMITED;
+ g->state = FLX_ENTRY_GROUP_UNCOMMITED;
g->n_probing = 0;
FLX_LLIST_HEAD_INIT(flxEntry, g->entries);
g_assert(g);
g_assert(!g->dead);
- if (g->status != FLX_ENTRY_GROUP_UNCOMMITED)
+ if (g->state != FLX_ENTRY_GROUP_UNCOMMITED)
return;
- flx_entry_group_run_callback(g, g->status = FLX_ENTRY_GROUP_REGISTERING);
+ flx_entry_group_run_callback(g, g->state = FLX_ENTRY_GROUP_REGISTERING);
flx_announce_group(g->server, g);
flx_entry_group_check_probed(g, FALSE);
}
g_assert(!e->dead);
return !e->group ||
- e->group->status == FLX_ENTRY_GROUP_REGISTERING ||
- e->group->status == FLX_ENTRY_GROUP_ESTABLISHED;
+ e->group->state == FLX_ENTRY_GROUP_REGISTERING ||
+ e->group->state == FLX_ENTRY_GROUP_ESTABLISHED;
}
-flxEntryGroupStatus flx_entry_group_get_status(flxEntryGroup *g) {
+flxEntryGroupState flx_entry_group_get_state(flxEntryGroup *g) {
g_assert(g);
g_assert(!g->dead);
- return g->status;
+ return g->state;
}
flxServer *server;
gboolean dead;
- flxEntryGroupStatus status;
+ flxEntryGroupState state;
gpointer userdata;
flxEntryGroupCallback callback;
void flx_server_post_query(flxServer *s, gint interface, guchar protocol, flxKey *key);
void flx_server_post_response(flxServer *s, gint interface, guchar protocol, flxRecord *record, gboolean flush_cache);
-void flx_entry_group_run_callback(flxEntryGroup *g, flxEntryGroupStatus state);
+void flx_entry_group_run_callback(flxEntryGroup *g, flxEntryGroupState state);
gboolean flx_entry_commited(flxEntry *e);