Exemplo n.º 1
0
static int
agent_peer_purge (const char *key, void *item, void *argument)
{
    zre_peer_t *peer = (zre_peer_t *) item;
    char *endpoint = (char *) argument;
    if (streq (zre_peer_endpoint (peer), endpoint))
        zre_peer_disconnect (peer);
    return 0;
}
Exemplo n.º 2
0
int
zre_peer_send (zre_peer_t *self, zre_msg_t **msg_p)
{
    assert (self);
    if (self->connected) {
        zre_msg_sequence_set (*msg_p, ++(self->sent_sequence));
        if (zre_msg_send (msg_p, self->mailbox) && errno == EAGAIN) {
            zre_peer_disconnect (self);
            return -1;
        }
    }
    return 0;
}
Exemplo n.º 3
0
void
zre_peer_destroy (zre_peer_t **self_p)
{
    assert (self_p);
    if (*self_p) {
        zre_peer_t *self = *self_p;
        zre_peer_disconnect (self);
        zhash_destroy (&self->headers);
        free (self->identity);
        free (self);
        *self_p = NULL;
    }
}