| 3808 | }; |
| 3809 | |
| 3810 | void |
| 3811 | TSHttpSsnReenable(TSHttpSsn ssnp, TSEvent event) |
| 3812 | { |
| 3813 | sdk_assert(sdk_sanity_check_http_ssn(ssnp) == TS_SUCCESS); |
| 3814 | |
| 3815 | ProxySession *cs = reinterpret_cast<ProxySession *>(ssnp); |
| 3816 | EThread *eth = this_ethread(); |
| 3817 | |
| 3818 | // If this function is being executed on a thread created by the API |
| 3819 | // which is DEDICATED, the continuation needs to be called back on a |
| 3820 | // REGULAR thread. Specially an ET_NET thread |
| 3821 | if (!eth->is_event_type(ET_NET)) { |
| 3822 | EThread *affinity_thread = cs->getThreadAffinity(); |
| 3823 | if (affinity_thread && affinity_thread->is_event_type(ET_NET)) { |
| 3824 | NetHandler *nh = get_NetHandler(affinity_thread); |
| 3825 | affinity_thread->schedule_imm(new TSHttpSsnCallback(cs, nh->mutex, event), ET_NET); |
| 3826 | } else { |
| 3827 | eventProcessor.schedule_imm(new TSHttpSsnCallback(cs, cs->mutex, event), ET_NET); |
| 3828 | } |
| 3829 | } else { |
| 3830 | MUTEX_TRY_LOCK(trylock, cs->mutex, eth); |
| 3831 | if (!trylock.is_locked()) { |
| 3832 | EThread *affinity_thread = cs->getThreadAffinity(); |
| 3833 | if (affinity_thread && affinity_thread->is_event_type(ET_NET)) { |
| 3834 | NetHandler *nh = get_NetHandler(affinity_thread); |
| 3835 | affinity_thread->schedule_imm(new TSHttpSsnCallback(cs, nh->mutex, event), ET_NET); |
| 3836 | } else { |
| 3837 | eventProcessor.schedule_imm(new TSHttpSsnCallback(cs, cs->mutex, event), ET_NET); |
| 3838 | } |
| 3839 | } else { |
| 3840 | cs->handleEvent(static_cast<int>(event), nullptr); |
| 3841 | } |
| 3842 | } |
| 3843 | } |
| 3844 | |
| 3845 | /* HTTP transactions */ |
| 3846 | void |