| 99 | } |
| 100 | |
| 101 | int main(int argc, char* argv[]) |
| 102 | { |
| 103 | std::vector<acl::string> addrs; |
| 104 | int ch, n = 0; |
| 105 | |
| 106 | while ((ch = getopt(argc, argv, "hs:f:n:")) > 0) { |
| 107 | switch (ch) { |
| 108 | case 'h': |
| 109 | usage(argv[0]); |
| 110 | return 0; |
| 111 | case 's': |
| 112 | add_servers(addrs, optarg); |
| 113 | break; |
| 114 | case 'f': |
| 115 | load_servers(addrs, optarg); |
| 116 | break; |
| 117 | case 'n': |
| 118 | n = atoi(optarg); |
| 119 | break; |
| 120 | default: |
| 121 | break; |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | if (addrs.empty()) { |
| 126 | usage(argv[0]); |
| 127 | return 0; |
| 128 | } |
| 129 | |
| 130 | std::vector<acl::thread*> threads; |
| 131 | |
| 132 | for (std::vector<acl::string>::const_iterator cit = addrs.begin(); |
| 133 | cit != addrs.end(); ++cit) { |
| 134 | |
| 135 | acl::thread* thr = new client(*cit, n); |
| 136 | threads.push_back(thr); |
| 137 | thr->start(); |
| 138 | } |
| 139 | |
| 140 | for (std::vector<acl::thread*>::iterator it = threads.begin(); |
| 141 | it != threads.end(); ++it) { |
| 142 | |
| 143 | (*it)->wait(); |
| 144 | delete *it; |
| 145 | } |
| 146 | return 0; |
| 147 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…