| 1417 | }; |
| 1418 | |
| 1419 | int |
| 1420 | server_handler(TSCont contp, TSEvent event, void *data) |
| 1421 | { |
| 1422 | SDK_NetVConn_Params *params = static_cast<SDK_NetVConn_Params *>(TSContDataGet(contp)); |
| 1423 | |
| 1424 | if (event == TS_EVENT_NET_ACCEPT) { |
| 1425 | // Kick off a read so that we can receive an EOS event. |
| 1426 | SDK_RPRINT(params->test, params->api, "ServerEvent NET_ACCEPT", TC_PASS, "ok"); |
| 1427 | params->buffer = TSIOBufferCreate(); |
| 1428 | params->vc = static_cast<TSVConn>(data); |
| 1429 | TSVConnRead(static_cast<TSVConn>(data), contp, params->buffer, 100); |
| 1430 | } else if (event == TS_EVENT_VCONN_EOS) { |
| 1431 | // The server end of the test passes if it receives an EOF event. This means that it must have |
| 1432 | // connected to the endpoint. Since this always happens *after* the accept, we know that it is |
| 1433 | // safe to delete the params. |
| 1434 | TSContDestroy(contp); |
| 1435 | |
| 1436 | SDK_RPRINT(params->test, params->api, "ServerEvent EOS", TC_PASS, "ok"); |
| 1437 | *params->pstatus = REGRESSION_TEST_PASSED; |
| 1438 | delete params; |
| 1439 | } else if (event == TS_EVENT_VCONN_READ_READY) { |
| 1440 | SDK_RPRINT(params->test, params->api, "ServerEvent READ_READY", TC_PASS, "ok"); |
| 1441 | } else { |
| 1442 | SDK_RPRINT(params->test, params->api, "ServerEvent", TC_FAIL, "received unexpected event %d", event); |
| 1443 | *params->pstatus = REGRESSION_TEST_FAILED; |
| 1444 | delete params; |
| 1445 | } |
| 1446 | |
| 1447 | return 1; |
| 1448 | } |
| 1449 | |
| 1450 | int |
| 1451 | client_handler(TSCont contp, TSEvent event, void *data) |
nothing calls this directly
no test coverage detected