summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2018-08-01 23:02:13 +0000
committeriphydf <iphydf@users.noreply.github.com>2018-08-16 21:01:43 +0000
commitd6d305feeb76735ee4b4e14c6bca737a5482bc19 (patch)
tree99005c635a452245006b3b5de44f1dd80da9f77f /testing
parent54066f338f185f2fbd6694d9a4877f42cbfa21c8 (diff)
Use per-instance `Mono_Time` for Messenger and onion.
Diffstat (limited to 'testing')
-rw-r--r--testing/DHT_test.c8
-rw-r--r--testing/Messenger_test.c11
2 files changed, 12 insertions, 7 deletions
diff --git a/testing/DHT_test.c b/testing/DHT_test.c
index 1d01f0a2..5e5f6834 100644
--- a/testing/DHT_test.c
+++ b/testing/DHT_test.c
@@ -190,11 +190,11 @@ int main(int argc, char *argv[])
190 IP ip; 190 IP ip;
191 ip_init(&ip, ipv6enabled); 191 ip_init(&ip, ipv6enabled);
192 192
193 DHT *dht = new_dht(nullptr, new_networking(nullptr, ip, PORT), true); 193 Mono_Time *const mono_time = mono_time_new();
194 DHT *dht = new_dht(nullptr, mono_time, new_networking(nullptr, ip, PORT), true);
194 printf("OUR ID: "); 195 printf("OUR ID: ");
195 uint32_t i;
196 196
197 for (i = 0; i < 32; i++) { 197 for (uint32_t i = 0; i < 32; i++) {
198 const uint8_t *const self_public_key = dht_get_self_public_key(dht); 198 const uint8_t *const self_public_key = dht_get_self_public_key(dht);
199 199
200 if (self_public_key[i] < 16) { 200 if (self_public_key[i] < 16) {
@@ -238,7 +238,7 @@ int main(int argc, char *argv[])
238#endif 238#endif
239 239
240 while (1) { 240 while (1) {
241 unix_time_update(); 241 mono_time_update(mono_time);
242 242
243 do_dht(dht); 243 do_dht(dht);
244 244
diff --git a/testing/Messenger_test.c b/testing/Messenger_test.c
index a5abfda0..880fc514 100644
--- a/testing/Messenger_test.c
+++ b/testing/Messenger_test.c
@@ -107,11 +107,16 @@ int main(int argc, char *argv[])
107 exit(0); 107 exit(0);
108 } 108 }
109 109
110 unix_time_update(); 110 Mono_Time *const mono_time = mono_time_new();
111
112 if (mono_time == nullptr) {
113 fputs("Failed to allocate monotonic timer datastructure\n", stderr);
114 exit(0);
115 }
111 116
112 Messenger_Options options = {0}; 117 Messenger_Options options = {0};
113 options.ipv6enabled = ipv6enabled; 118 options.ipv6enabled = ipv6enabled;
114 m = new_messenger(&options, nullptr); 119 m = new_messenger(mono_time, &options, nullptr);
115 120
116 if (!m) { 121 if (!m) {
117 fputs("Failed to allocate messenger datastructure\n", stderr); 122 fputs("Failed to allocate messenger datastructure\n", stderr);
@@ -180,7 +185,7 @@ int main(int argc, char *argv[])
180 perror("Initialization"); 185 perror("Initialization");
181 186
182 while (1) { 187 while (1) {
183 unix_time_update(); 188 mono_time_update(mono_time);
184 189
185 uint8_t name[128]; 190 uint8_t name[128];
186 const char *const filename = "Save.bak"; 191 const char *const filename = "Save.bak";