void close_client(epdata_t *epd) { if(!epd) { return; } if(epd->ssl && epd->fd > -1) { if(!SSL_shutdown(epd->ssl)) { shutdown(epd->fd, 1); SSL_shutdown(epd->ssl); } SSL_free(epd->ssl); epd->ssl = NULL; } if(epd->L) { if(epd->status == STEP_PROCESS) { LOGF(ERR, "at working!!!"); } release_lua_thread(epd->L); epd->L = NULL; } if(epd->status == STEP_READ) { serv_status.reading_counts--; } else if(epd->status == STEP_SEND) { serv_status.sending_counts--; } se_delete(epd->se_ptr); delete_timeout(epd->timeout_ptr); epd->timeout_ptr = NULL; if(epd->fd > -1) { serv_status.active_counts--; close(epd->fd); epd->fd = -1; } free_epd(epd); }
void init_lua_threads(lua_State *_L, int count) { int i = 0; void *LS = malloc(sizeof(void *)*count); for(i = 0; i < count; i++) { void **L = LS + (i * sizeof(void *)); *L = new_lua_thread(_L); } for(i = 0; i < count; i++) { void **L = LS + (i * sizeof(void *)); if(*L) { release_lua_thread(*L); } } free(LS); }