void McServerSession::onRequestReplied(McServerTransaction& transaction) {

  DestructorGuard dg(this);

  if (parser_.outOfOrder()) {
    queueWrite(unansweredRequests_.extract(
      unansweredRequests_.iterator_to(transaction)));
  } else {
    while (!unansweredRequests_.empty() &&
           unansweredRequests_.front().replyReady()) {
      queueWrite(unansweredRequests_.popFront());
    }
  }
}
Beispiel #2
0
// Send to the client a list of available graphs
void SocketConnection::sendList() {
    struct graph_list_t replydg;

    // Set up the response body, and queue it for sending
    std::memset(&replydg, 0, sizeof(struct graph_list_t));

    // Set the type of the datagram
    replydg.type = 'l';

    for (unsigned int i = 0; i < graphNames.size(); i++) {
        // Is this the last element in the list?
        if (i + 1 == graphNames.size()) {
            replydg.end = 1;
        }
        else {
            replydg.end = 0;
        }

        // Copy in the string
        std::strcpy(replydg.dataset, graphNames[i].c_str());

        // Queue the datagram for writing
        queueWrite(replydg);
    }
}