| 360 | } |
| 361 | |
| 362 | int |
| 363 | Http1ClientSession::state_keep_alive(int event, void *data) |
| 364 | { |
| 365 | // Route the event. It is either for vc or |
| 366 | // the origin server slave vc |
| 367 | if (data) { |
| 368 | if (data == slave_ka_vio) { |
| 369 | return state_slave_keep_alive(event, data); |
| 370 | } else if (data == schedule_event) { |
| 371 | schedule_event = nullptr; |
| 372 | } else { |
| 373 | ink_assert(data && data == ka_vio); |
| 374 | ink_assert(read_state == HCS_KEEP_ALIVE); |
| 375 | } |
| 376 | } |
| 377 | |
| 378 | // If we got here due to a network I/O event directly, go ahead and cancel any remaining schedule events |
| 379 | if (schedule_event) { |
| 380 | schedule_event->cancel(); |
| 381 | schedule_event = nullptr; |
| 382 | } |
| 383 | |
| 384 | STATE_ENTER(&Http1ClientSession::state_keep_alive, event, data); |
| 385 | |
| 386 | switch (event) { |
| 387 | case VC_EVENT_READ_READY: |
| 388 | // New transaction, need to spawn of new sm to process |
| 389 | // request |
| 390 | new_transaction(); |
| 391 | break; |
| 392 | |
| 393 | case VC_EVENT_EOS: |
| 394 | this->do_io_close(EHTTP_ERROR); |
| 395 | break; |
| 396 | |
| 397 | case VC_EVENT_READ_COMPLETE: |
| 398 | default: |
| 399 | // These events are bogus |
| 400 | ink_assert(0); |
| 401 | // Fall through |
| 402 | case VC_EVENT_ERROR: |
| 403 | case VC_EVENT_ACTIVE_TIMEOUT: |
| 404 | case VC_EVENT_INACTIVITY_TIMEOUT: |
| 405 | // Keep-alive timed out |
| 406 | this->do_io_close(EHTTP_ERROR); |
| 407 | break; |
| 408 | } |
| 409 | |
| 410 | return 0; |
| 411 | } |
| 412 | |
| 413 | // Called from the Http1Transaction::release or at the start of a session for |
| 414 | // the very first transaction from Http1ClientSession::new_connection. |
nothing calls this directly
no test coverage detected