between client and cache
| 1488 | |
| 1489 | // between client and cache |
| 1490 | int |
| 1491 | MC::stream_event(int event, void *data) |
| 1492 | { |
| 1493 | if (data == crvio || data == cwvio) { |
| 1494 | switch (event) { |
| 1495 | case VC_EVENT_READ_READY: |
| 1496 | wvio->reenable(); |
| 1497 | break; |
| 1498 | case VC_EVENT_WRITE_READY: |
| 1499 | rvio->reenable(); |
| 1500 | break; |
| 1501 | case VC_EVENT_WRITE_COMPLETE: |
| 1502 | case VC_EVENT_EOS: |
| 1503 | case VC_EVENT_READ_COMPLETE: |
| 1504 | return TS_POP_CALL(TSMEMCACHE_STREAM_DONE, 0); |
| 1505 | default: |
| 1506 | return die(); |
| 1507 | } |
| 1508 | } else { |
| 1509 | switch (event) { |
| 1510 | case VC_EVENT_READ_READY: |
| 1511 | if (cwvio) { |
| 1512 | if (creader != reader && creader->read_avail() < cwvio->nbytes) { |
| 1513 | int64_t a = reader->read_avail(); |
| 1514 | if (a > static_cast<int64_t>(nbytes)) { |
| 1515 | a = static_cast<int64_t>(nbytes); |
| 1516 | } |
| 1517 | if (a) { |
| 1518 | cbuf->write(reader, a); |
| 1519 | reader->consume(a); |
| 1520 | } |
| 1521 | } |
| 1522 | cwvio->reenable(); |
| 1523 | } |
| 1524 | break; |
| 1525 | case VC_EVENT_WRITE_READY: |
| 1526 | if (crvio) { |
| 1527 | crvio->reenable(); |
| 1528 | } |
| 1529 | break; |
| 1530 | case VC_EVENT_WRITE_COMPLETE: |
| 1531 | case VC_EVENT_READ_COMPLETE: |
| 1532 | return TS_POP_CALL(TSMEMCACHE_STREAM_DONE, 0); |
| 1533 | default: |
| 1534 | return die(); |
| 1535 | } |
| 1536 | } |
| 1537 | return EVENT_CONT; |
| 1538 | } |
| 1539 | |
| 1540 | // cache to cache |
| 1541 | int |
nothing calls this directly
no test coverage detected