@@ -290,7 +290,7 @@ bool Client::query_mlabns() noexcept {
290
290
}
291
291
std::string body;
292
292
if (!query_mlabns_curl ( //
293
- impl->settings .mlabns_url , impl->settings .curl_timeout , &body)) {
293
+ impl->settings .mlabns_url , impl->settings .timeout , &body)) {
294
294
return false ;
295
295
}
296
296
nlohmann::json json;
@@ -383,20 +383,20 @@ bool Client::recv_tests_ids() noexcept {
383
383
bool Client::run_tests () noexcept {
384
384
for (auto &tid : impl->granted_suite ) {
385
385
switch (tid) {
386
- case nettest ::upload:
386
+ case nettest_flag ::upload:
387
387
EMIT_INFO (" running upload test" );
388
388
if (!run_upload ()) {
389
389
return false ;
390
390
}
391
391
break ;
392
- case nettest ::meta:
392
+ case nettest_flag ::meta:
393
393
EMIT_DEBUG (" running meta test" ); // don't annoy the user with this
394
394
if (!run_meta ()) {
395
395
return false ;
396
396
}
397
397
break ;
398
- case nettest ::download:
399
- case nettest ::download_ext:
398
+ case nettest_flag ::download:
399
+ case nettest_flag ::download_ext:
400
400
EMIT_INFO (" running download test" );
401
401
if (!run_download ()) {
402
402
return false ;
@@ -543,7 +543,7 @@ bool Client::run_download() noexcept {
543
543
std::chrono::duration<double > measurement_interval = now - prev;
544
544
std::chrono::duration<double > elapsed = now - begin;
545
545
if (measurement_interval.count () > 0.25 ) {
546
- on_performance (nettest ::download, nflows, recent_data,
546
+ on_performance (nettest_flag ::download, nflows, recent_data,
547
547
measurement_interval.count (), elapsed.count (),
548
548
impl->settings .max_runtime );
549
549
recent_data = 0 ;
@@ -711,7 +711,7 @@ bool Client::run_upload() noexcept {
711
711
std::chrono::duration<double > measurement_interval = now - prev;
712
712
std::chrono::duration<double > elapsed = now - begin;
713
713
if (measurement_interval.count () > 0.25 ) {
714
- on_performance (nettest ::upload, nflows, recent_data,
714
+ on_performance (nettest_flag ::upload, nflows, recent_data,
715
715
measurement_interval.count (), elapsed.count (),
716
716
impl->settings .max_runtime );
717
717
recent_data = 0 ;
@@ -750,32 +750,34 @@ bool Client::run_upload() noexcept {
750
750
// Low-level API
751
751
752
752
bool Client::msg_write_login (const std::string &version) noexcept {
753
- static_assert (sizeof (impl->settings .test_suite ) == 1 , " test_suite too large" );
753
+ static_assert (sizeof (impl->settings .nettest_flags ) == 1 ,
754
+ " nettest_flags too large" );
754
755
uint8_t code = 0 ;
755
- impl->settings .test_suite |= nettest ::status | nettest ::meta;
756
- if ((impl->settings .test_suite & nettest ::middlebox)) {
757
- EMIT_WARNING (" msg_write_login(): nettest ::middlebox: not implemented" );
758
- impl->settings .test_suite &= ~nettest ::middlebox;
756
+ impl->settings .nettest_flags |= nettest_flag ::status | nettest_flag ::meta;
757
+ if ((impl->settings .nettest_flags & nettest_flag ::middlebox)) {
758
+ EMIT_WARNING (" msg_write_login(): nettest_flag ::middlebox: not implemented" );
759
+ impl->settings .nettest_flags &= ~nettest_flag ::middlebox;
759
760
}
760
- if ((impl->settings .test_suite & nettest ::simple_firewall)) {
761
+ if ((impl->settings .nettest_flags & nettest_flag ::simple_firewall)) {
761
762
EMIT_WARNING (
762
- " msg_write_login(): nettest ::simple_firewall: not implemented" );
763
- impl->settings .test_suite &= ~nettest ::simple_firewall;
763
+ " msg_write_login(): nettest_flag ::simple_firewall: not implemented" );
764
+ impl->settings .nettest_flags &= ~nettest_flag ::simple_firewall;
764
765
}
765
- if ((impl->settings .test_suite & nettest::upload_ext)) {
766
- EMIT_WARNING (" msg_write_login(): nettest::upload_ext: not implemented" );
767
- impl->settings .test_suite &= ~nettest::upload_ext;
766
+ if ((impl->settings .nettest_flags & nettest_flag::upload_ext)) {
767
+ EMIT_WARNING (
768
+ " msg_write_login(): nettest_flag::upload_ext: not implemented" );
769
+ impl->settings .nettest_flags &= ~nettest_flag::upload_ext;
768
770
}
769
771
std::string serio;
770
- if ((impl->settings .proto & protocol ::json) == 0 ) {
771
- serio = std::string{(char *)&impl->settings .test_suite ,
772
- sizeof (impl->settings .test_suite )};
772
+ if ((impl->settings .protocol_flags & protocol_flag ::json) == 0 ) {
773
+ serio = std::string{(char *)&impl->settings .nettest_flags ,
774
+ sizeof (impl->settings .nettest_flags )};
773
775
code = msg_login;
774
776
} else {
775
777
code = msg_extended_login;
776
778
nlohmann::json msg{
777
779
{" msg" , version},
778
- {" tests" , std::to_string ((unsigned )impl->settings .test_suite )},
780
+ {" tests" , std::to_string ((unsigned )impl->settings .nettest_flags )},
779
781
};
780
782
try {
781
783
serio = msg.dump ();
@@ -785,7 +787,7 @@ bool Client::msg_write_login(const std::string &version) noexcept {
785
787
}
786
788
}
787
789
assert (code != 0 );
788
- if ((impl->settings .proto & protocol ::websockets) != 0 ) {
790
+ if ((impl->settings .protocol_flags & protocol_flag ::websockets) != 0 ) {
789
791
EMIT_WARNING (" msg_write_login: websockets not supported" );
790
792
return false ;
791
793
}
@@ -800,7 +802,7 @@ bool Client::msg_write_login(const std::string &version) noexcept {
800
802
// a different implementation depending on the actual protocol.
801
803
bool Client::msg_write (uint8_t code, std::string &&msg) noexcept {
802
804
EMIT_DEBUG (" msg_write: message to send: " << represent (msg));
803
- if ((impl->settings .proto & protocol ::json) != 0 ) {
805
+ if ((impl->settings .protocol_flags & protocol_flag ::json) != 0 ) {
804
806
nlohmann::json json;
805
807
json[" msg" ] = msg;
806
808
try {
@@ -810,7 +812,7 @@ bool Client::msg_write(uint8_t code, std::string &&msg) noexcept {
810
812
return false ;
811
813
}
812
814
}
813
- if ((impl->settings .proto & protocol ::websockets) != 0 ) {
815
+ if ((impl->settings .protocol_flags & protocol_flag ::websockets) != 0 ) {
814
816
EMIT_WARNING (" msg_write: websockets not supported" );
815
817
return false ;
816
818
}
@@ -944,14 +946,14 @@ bool Client::msg_expect(uint8_t expected_code, std::string *s) noexcept {
944
946
bool Client::msg_read (uint8_t *code, std::string *msg) noexcept {
945
947
assert (code != nullptr && msg != nullptr );
946
948
std::string s;
947
- if ((impl->settings .proto & protocol ::websockets) != 0 ) {
949
+ if ((impl->settings .protocol_flags & protocol_flag ::websockets) != 0 ) {
948
950
EMIT_WARNING (" msg_read: websockets not supported" );
949
951
return false ;
950
952
}
951
953
if (!msg_read_legacy (code, &s)) {
952
954
return false ;
953
955
}
954
- if ((impl->settings .proto & protocol ::json) == 0 ) {
956
+ if ((impl->settings .protocol_flags & protocol_flag ::json) == 0 ) {
955
957
std::swap (s, *msg);
956
958
} else {
957
959
nlohmann::json json;
0 commit comments