Use constexpr

pull/18010/head
Yash Tibrewal 6 years ago
parent 5a44f700bb
commit 6a372ff442
  1. 12
      src/core/lib/iomgr/tcp_posix.cc

@ -715,13 +715,15 @@ static void process_errors(grpc_tcp* tcp) {
msg.msg_iovlen = 0;
msg.msg_flags = 0;
/* Allocate enough space so we don't need to keep increasing this as size
* of OPT_STATS increase */
constexpr size_t cmsg_alloc_space =
1024 /*CMSG_SPACE(sizeof(grpc_core::scm_timestamping)) +
CMSG_SPACE(sizeof(sock_extended_err) + sizeof(sockaddr_in)) +
CMSG_SPACE(16 * NLA_ALIGN(NLA_HDRLEN + sizeof(uint64_t)))*/;
/* Allocate aligned space for cmsgs received along with timestamps */
union {
/* Allocate enough space so we don't need to keep increasing this as size
* of OPT_STATS increase */
char rbuf[1024 /*CMSG_SPACE(sizeof(grpc_core::scm_timestamping)) +
CMSG_SPACE(sizeof(sock_extended_err) + sizeof(sockaddr_in)) +
CMSG_SPACE(16 * NLA_ALIGN(NLA_HDRLEN + sizeof(uint64_t)))*/];
char rbuf[cmsg_alloc_space];
struct cmsghdr align;
} aligned_buf;
memset(&aligned_buf, 0, sizeof(aligned_buf));

Loading…
Cancel
Save