| 181 | |
| 182 | @asyncio.coroutine |
| 183 | def do_bomb(in_iter): |
| 184 | nonlocal processed_count |
| 185 | for rnd in in_iter: |
| 186 | real_url = url + '/test/' + rnd |
| 187 | try: |
| 188 | t1 = loop.time() |
| 189 | resp = yield from client.get(real_url) |
| 190 | assert resp.status == 200, resp.status |
| 191 | if 'text/plain; charset=utf-8' != resp.headers['Content-Type']: |
| 192 | raise AssertionError('Invalid Content-Type: %r' % |
| 193 | resp.headers) |
| 194 | body = yield from resp.text() |
| 195 | yield from resp.release() |
| 196 | assert body == ('Hello, ' + rnd), rnd |
| 197 | t2 = loop.time() |
| 198 | out_times.append(t2 - t1) |
| 199 | processed_count += 1 |
| 200 | except Exception: |
| 201 | continue |
| 202 | |
| 203 | in_iter = gen() |
| 204 | bombers = [] |