/*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
eventBase_(evb),
fd_(-1),
readCallback_(nullptr) {
- DCHECK(evb->isInEventBaseThread());
+ evb->dcheckIsInEventBaseThread();
}
AsyncUDPSocket::~AsyncUDPSocket() {
}
void AsyncUDPSocket::close() {
- DCHECK(eventBase_->isInEventBaseThread());
+ eventBase_->dcheckIsInEventBaseThread();
if (readCallback_) {
auto cob = readCallback_;
struct sockaddr_storage addrStorage;
socklen_t addrLen = sizeof(addrStorage);
- memset(&addrStorage, 0, addrLen);
+ memset(&addrStorage, 0, size_t(addrLen));
struct sockaddr* rawAddr = reinterpret_cast<sockaddr*>(&addrStorage);
rawAddr->sa_family = localAddress_.getFamily();
bool truncated = false;
if ((size_t)bytesRead > len) {
truncated = true;
- bytesRead = len;
+ bytesRead = ssize_t(len);
}
- readCallback_->onDataAvailable(clientAddress_, bytesRead, truncated);
+ readCallback_->onDataAvailable(
+ clientAddress_, size_t(bytesRead), truncated);
}
} else {
if (errno == EAGAIN || errno == EWOULDBLOCK) {
flags |= READ;
}
- return registerHandler(flags | PERSIST);
+ return registerHandler(uint16_t(flags | PERSIST));
}
} // Namespace