Reject null event base arguments

Summary:
If you use a null eventbase, folly implicitly decides which one to run the futures in, for example
the timekeeper thread.
The only component that passes in event bases is sonar.cpp.

Reviewed By: priteshrnandgaonkar

Differential Revision: D9539443

fbshipit-source-id: 7fd7289257c84b039a7ac00b14f78bb271262480
This commit is contained in:
John Knox
2018-09-03 11:10:52 -07:00
committed by Facebook Github Bot
parent 661d5a8f5b
commit a5af72a169
2 changed files with 95 additions and 1 deletions

View File

@@ -21,6 +21,7 @@
#include <iostream>
#include <thread>
#include <folly/io/async/AsyncSocketException.h>
#include <stdexcept>
#include "CertificateUtils.h"
#ifdef __ANDROID__
@@ -96,7 +97,10 @@ class Responder : public rsocket::RSocketResponder {
};
SonarWebSocketImpl::SonarWebSocketImpl(SonarInitConfig config, std::shared_ptr<SonarState> state)
: deviceData_(config.deviceData), sonarState_(state), sonarEventBase_(config.callbackWorker), connectionEventBase_(config.connectionWorker) {}
: deviceData_(config.deviceData), sonarState_(state), sonarEventBase_(config.callbackWorker), connectionEventBase_(config.connectionWorker) {
CHECK_THROW(config.callbackWorker, std::invalid_argument);
CHECK_THROW(config.connectionWorker, std::invalid_argument);
}
SonarWebSocketImpl::~SonarWebSocketImpl() {
stop();