示例#1
0
/* Notify the listener that the client has finished sending a message, and
 * transfer all details for handling the response to it. Blocking. */
static bool enqueue_EXPECT_message_to_listener(bus *b, boxed_msg *box) {
    /* Notify listener that it should expect a response to a
     * successfully sent message. */
    BUS_LOG_SNPRINTF(b, 3, LOG_SENDER, b->udata, 128,
        "telling listener to EXPECT sent response, with box %p, seq_id %lld",
        (void *)box, (long long)box->out_seq_id);
    
    if (box->result.status == BUS_SEND_UNDEFINED) {
        box->result.status = BUS_SEND_REQUEST_COMPLETE;
    }

    struct listener *l = Bus_GetListenerForSocket(b, box->fd);

    for (int retries = 0; retries < SEND_NOTIFY_LISTENER_RETRIES; retries++) {
        #ifndef TEST
        uint16_t backpressure = 0;
        #endif
        /* If this succeeds, then this thread cannot touch the box anymore. */
        if (Listener_ExpectResponse(l, box, &backpressure)) {
            Bus_BackpressureDelay(b, backpressure,
                LISTENER_EXPECT_BACKPRESSURE_SHIFT);
            return true;
        } else {
            BUS_LOG_SNPRINTF(b, 5, LOG_SENDER, b->udata, 64,
                "enqueue_request_sent: failed delivery %d", retries);
            syscall_poll(NULL, 0, SEND_NOTIFY_LISTENER_RETRY_DELAY);
        }
    }

    /* Timeout, will be treated as a TX error */
    return false;
}
示例#2
0
SSL* KineticSession_GetSSL(KineticSession * const session)
{
    SSL * p = NULL;

    if(session->config.useSsl == false){
      return NULL;
    }

    struct listener* li = Bus_GetListenerForSocket(session->messageBus,session->socket);
    if(li == NULL){
      return NULL;
    }

    for(int x = 0; x < li->tracked_fds; x++){

      if(li->fd_info[x] == NULL){
        continue;
      }

      p = li->fd_info[x]->ssl;

      if(p != ((SSL *)-2)) {// BUS_NO_SSL
        return p;
      }
    }

    return p;
}