Skip to content

Instantly share code, notes, and snippets.

@mxposed
Created October 19, 2012 13:21
Show Gist options
  • Save mxposed/3918196 to your computer and use it in GitHub Desktop.
Save mxposed/3918196 to your computer and use it in GitHub Desktop.
Update endpoint bug proof
std::vector<cocaine_endpoint_t> new_endpoints;
std::vector<cocaine_endpoint_t> missing_endpoints2;
get_endpoints_diff(endpoints, new_endpoints, missing_endpoints);
if (!missing_endpoints.empty()) {
for (size_t i = 0; i < m_endpoints.size(); ++i) {
if (false == std::binary_search(endpoints_tmp.begin(), endpoints_tmp.end(), m_endpoints[i])) {
missing_endpoints2.push_back(m_endpoints[i]);
}
}
log(PLOG_DEBUG, "missing %d endpoints", missing_endpoints.size());
log(PLOG_DEBUG, "missing %d endpoints on sorted", missing_endpoints2.size());
if (log_flag_enabled(PLOG_DEBUG)) {
log(PLOG_DEBUG, "missing endpoints on " + m_socket_identity);
}
recreate_socket();
connect(endpoints);
}
@mxposed
Copy link
Author

mxposed commented Oct 19, 2012

This code produces the following logs


[17:22:12][DEBUG]   missing 2 endpoints
[17:22:12][DEBUG]   missing 0 endpoints on sorted
[17:22:12][DEBUG]   missing endpoints on [conductor].[conductor].[new_package].4e24a864-c1b1-4e1e-826c-120fb841cc91
[17:22:12][DEBUG]   recreate_socket [conductor].[conductor].[new_package].4e24a864-c1b1-4e1e-826c-120fb841cc91
[17:22:12][DEBUG]   connect [conductor].[conductor].[new_package].4e24a864-c1b1-4e1e-826c-120fb841cc91
[17:22:12][DEBUG]   make_all_messages_new_for_route
[17:22:12][DEBUG]   make_all_messages_new_for_route

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment