lots of work on determinism in the linux driver.
This commit is contained in:
@@ -2,6 +2,15 @@
|
||||
#define CHBUF_SIZE (256*1024)
|
||||
#define POLLVEC_SIZE (DrivenEngine::MAX_CHAN+1)
|
||||
|
||||
int mallocstate(int n) {
|
||||
int64_t result = 0;
|
||||
for (int i = 0; i < n; i++) {
|
||||
int64_t n = int64_t(malloc(1));
|
||||
result = (result * 17) + n;
|
||||
}
|
||||
return result & 0x7fffffff;
|
||||
}
|
||||
|
||||
static MonoClock monoclock;
|
||||
|
||||
namespace util {
|
||||
@@ -17,7 +26,7 @@ static void if_error_print_and_exit(const UmmString &str) {
|
||||
}
|
||||
}
|
||||
|
||||
static SSL_CTX *new_ssl_context(bool server_cert, bool root_certs, const std::string &require_cert) {
|
||||
static SSL_CTX *new_ssl_context(bool server_cert, bool root_certs, std::string_view require_cert) {
|
||||
SSL_CTX *ctx = SSL_CTX_new(TLS_method());
|
||||
SSL_CTX_set_mode(ctx, SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);
|
||||
SSL_CTX_set_mode(ctx, SSL_MODE_ENABLE_PARTIAL_WRITE);
|
||||
@@ -92,8 +101,8 @@ public:
|
||||
};
|
||||
|
||||
DrivenEngine *driven_;
|
||||
std::vector<ChanInfo> chans_;
|
||||
std::map<int, SOCKET> listen_sockets_;
|
||||
UmmVector<ChanInfo> chans_;
|
||||
UmmMap<int, SOCKET> listen_sockets_;
|
||||
bool read_console_recently_;
|
||||
|
||||
SSL_CTX *ssl_ctx_with_root_certs_;
|
||||
@@ -116,7 +125,17 @@ public:
|
||||
|
||||
void handle_lua_source() {
|
||||
if (driven_->drv_get_rescan_lua_source()) {
|
||||
driven_->drv_set_lua_source(util::read_lua_source("lua"));
|
||||
UmmString err;
|
||||
std::string_view ctrl = read_file("lua/control.lst", chbuf.get(), CHBUF_SIZE, err);
|
||||
if_error_print_and_exit(err);
|
||||
UmmStringVec names = drv::parse_control_lst(ctrl);
|
||||
driven_->drv_clear_lua_source();
|
||||
for (const UmmString &str : names) {
|
||||
UmmString lfn = UmmString("lua/") + str;
|
||||
std::string_view data = read_file(lfn.c_str(), chbuf.get(), CHBUF_SIZE, err);
|
||||
if_error_print_and_exit(err);
|
||||
driven_->drv_add_lua_source(str, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -458,7 +477,7 @@ public:
|
||||
}
|
||||
|
||||
DrivenEngine::set(de);
|
||||
driven_->drv_set_lua_source(util::read_lua_source("lua"));
|
||||
handle_lua_source();
|
||||
driven_->drv_invoke_event_init(argc, argv);
|
||||
handle_listen_ports();
|
||||
|
||||
@@ -490,12 +509,17 @@ void driver_drive(int argc, char *argv[]) {
|
||||
// doesn't break the determinism of the execution during replay.
|
||||
|
||||
umm_init_heap(malloc(OPENSSL_HEAP_SIZE), OPENSSL_HEAP_SIZE);
|
||||
|
||||
CRYPTO_set_mem_functions(umm_malloc_ssl, umm_realloc_ssl, umm_free_ssl);
|
||||
|
||||
chbuf.reset(new char[CHBUF_SIZE]);
|
||||
pollvec.reset(new struct pollfd[POLLVEC_SIZE]);
|
||||
|
||||
ERR_load_crypto_strings();
|
||||
SSL_load_error_strings();
|
||||
|
||||
std::cerr << "#2 " << std::hex << mallocstate(1) << std::endl;
|
||||
|
||||
Driver driver;
|
||||
if (argc < 2) {
|
||||
DrivenEngine::print_usage(std::cerr, argv[0]);
|
||||
|
||||
Reference in New Issue
Block a user