| 162 | } |
| 163 | |
| 164 | void run_tests ( |
| 165 | unsigned long timeout_to_use |
| 166 | ) |
| 167 | { |
| 168 | // make sure there aren't any threads running |
| 169 | wait(); |
| 170 | if (test_unix) |
| 171 | remove_test_socket(); |
| 172 | |
| 173 | port_num = 5000; |
| 174 | test_failed = false; |
| 175 | |
| 176 | print_spinner(); |
| 177 | data_to_send = "oi 2m3ormao2m fo2im3fo23mi o2mi3 foa2m3fao23ifm2o3fmia23oima23iom3giugbiua"; |
| 178 | // make the block of data much larger |
| 179 | for (int i = 0; i < 11; ++i) |
| 180 | data_to_send = data_to_send + data_to_send; |
| 181 | |
| 182 | dlog << LINFO << "data block size: " << data_to_send.size(); |
| 183 | |
| 184 | connection::socket_descriptor_type sock = 0; |
| 185 | std::unique_ptr<listener> list; |
| 186 | if (test_unix) { |
| 187 | if (test_user_sock) { |
| 188 | DLIB_TEST(create_listening_socket(sock, socket_name) == 0); |
| 189 | DLIB_TEST(create_listener_from_socket(list, sock) == 0); |
| 190 | } else { |
| 191 | DLIB_TEST(create_listener(list, socket_name) == 0); |
| 192 | } |
| 193 | } else { |
| 194 | if (test_user_sock) { |
| 195 | DLIB_TEST(create_listening_socket(sock, port_num, "127.0.0.1") == 0); |
| 196 | DLIB_TEST(create_listener_from_socket(list, sock) == 0); |
| 197 | } else { |
| 198 | DLIB_TEST(create_listener(list, port_num, "127.0.0.1") == 0); |
| 199 | } |
| 200 | } |
| 201 | DLIB_TEST(bool(list)); |
| 202 | |
| 203 | // kick off the sending threads |
| 204 | start(); |
| 205 | |
| 206 | |
| 207 | dlib::array<std::unique_ptr<connection> > cons; |
| 208 | std::vector<long> bytes_received(6,0); |
| 209 | std::unique_ptr<connection> con_temp; |
| 210 | |
| 211 | // accept the 6 connections we should get |
| 212 | for (int i = 0; i < 6; ++i) |
| 213 | { |
| 214 | DLIB_TEST(list->accept(con_temp) == 0); |
| 215 | cons.push_back(con_temp); |
| 216 | print_spinner(); |
| 217 | } |
| 218 | |
| 219 | int finished_cons = 0; |
| 220 | |
| 221 | // now receive all the bytes from the sending threads |
nothing calls this directly
no test coverage detected