Skip to content

Commit

Permalink
Fix various win32 compile issues (#9915)
Browse files Browse the repository at this point in the history
Signed-off-by: Sunjay Bhatia <[email protected]>
Signed-off-by: William A Rowe Jr <[email protected]>
  • Loading branch information
wrowe authored Feb 4, 2020
1 parent b495c36 commit 7fe8b23
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion bazel/foreign_cc/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ envoy_cmake_external(
"//bazel:windows_x86_64": [
"event.lib",
"event_core.lib",
"event_extra.lib",
],
"//conditions:default": [
"libevent.a",
"libevent_pthreads.a",
"libevent_core.a",
],
}),
)
Expand Down
11 changes: 6 additions & 5 deletions source/common/upstream/load_balancer_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,12 @@ void LoadBalancerBase::recalculatePerPriorityPanic() {
void LoadBalancerBase::recalculateLoadInTotalPanic() {
// First calculate total number of hosts across all priorities regardless
// whether they are healthy or not.
const uint32_t total_hosts_count = std::accumulate(
priority_set_.hostSetsPerPriority().begin(), priority_set_.hostSetsPerPriority().end(), 0,
[](size_t acc, const std::unique_ptr<Envoy::Upstream::HostSet>& host_set) {
return acc + host_set->hosts().size();
});
const uint32_t total_hosts_count =
std::accumulate(priority_set_.hostSetsPerPriority().begin(),
priority_set_.hostSetsPerPriority().end(), static_cast<size_t>(0),
[](size_t acc, const std::unique_ptr<Envoy::Upstream::HostSet>& host_set) {
return acc + host_set->hosts().size();
});

if (0 == total_hosts_count) {
// Backend is empty, but load must be distributed somewhere.
Expand Down
4 changes: 2 additions & 2 deletions source/extensions/transport_sockets/tls/context_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ ServerContextImpl::ServerContextImpl(Stats::Scope& scope,
}

int rc =
SSL_CTX_set_session_id_context(ctx.ssl_ctx_.get(), session_id.begin(), session_id.size());
SSL_CTX_set_session_id_context(ctx.ssl_ctx_.get(), session_id.data(), session_id.size());
RELEASE_ASSERT(rc == 1, Utility::getLastCryptoError().value_or(""));
}
}
Expand Down Expand Up @@ -1156,7 +1156,7 @@ ServerContextImpl::generateHashForSessionContextId(const std::vector<std::string
static_assert(session_id.size() == SHA256_DIGEST_LENGTH, "hash size mismatch");
static_assert(session_id.size() == SSL_MAX_SSL_SESSION_ID_LENGTH, "TLS session ID size mismatch");

rc = EVP_DigestFinal(md.get(), session_id.begin(), &hash_length);
rc = EVP_DigestFinal(md.get(), session_id.data(), &hash_length);
RELEASE_ASSERT(rc == 1, Utility::getLastCryptoError().value_or(""));
RELEASE_ASSERT(hash_length == session_id.size(),
"SHA256 hash length must match TLS Session ID size");
Expand Down
6 changes: 6 additions & 0 deletions test/common/filesystem/directory_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,13 @@ TEST_F(DirectoryTest, DirectoryWithBrokenSymlink) {
const EntrySet expected = {
{".", FileType::Directory},
{"..", FileType::Directory},
#ifndef WIN32
// On Linux, a broken directory link is simply a symlink to be rm'ed
{"link_dir", FileType::Regular},
#else
// On Windows, a broken directory link remains a directory link to be rmdir'ed
{"link_dir", FileType::Directory},
#endif
};
EXPECT_EQ(expected, getDirectoryContents(dir_path_, false));
}
Expand Down
1 change: 1 addition & 0 deletions tools/spelling_dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,7 @@ resync
ret
retriable
retriggers
rmdir
rollout
roundtrip
rpcs
Expand Down

0 comments on commit 7fe8b23

Please sign in to comment.