msg.msg_controllen = 0;
msg.msg_flags = 0;
- return ::sendmsg(fd_, &msg, 0);
+ return sendmsg(fd_, &msg, 0);
}
void AsyncUDPSocket::resumeRead(ReadCallback* cob) {
return eventBase_;
}
+ protected:
+ virtual ssize_t sendmsg(int socket, const struct msghdr* message, int flags) {
+ return ::sendmsg(socket, message, flags);
+ }
+
private:
AsyncUDPSocket(const AsyncUDPSocket&) = delete;
AsyncUDPSocket& operator=(const AsyncUDPSocket&) = delete;
#include <folly/io/async/EventBase.h>
#include <folly/io/IOBuf.h>
+#include <folly/portability/GMock.h>
#include <folly/portability/GTest.h>
#include <thread>
using folly::EventBase;
using folly::SocketAddress;
using folly::IOBuf;
+using namespace testing;
class UDPAcceptor
: public AsyncUDPServerSocket::Callback {
// Wait for server thread to joib
serverThread.join();
}
+
+class TestAsyncUDPSocket : public AsyncUDPSocket {
+ public:
+ explicit TestAsyncUDPSocket(EventBase* evb) : AsyncUDPSocket(evb) {}
+
+ MOCK_METHOD3(sendmsg, ssize_t(int, const struct msghdr*, int));
+};