void GentEvent::Handle(const int fd, const short which, void *arg) { GentConnect *c = static_cast<GentConnect *>(arg); if(c->fd != fd) { if(event_del(&c->ev) == -1) { LOG(GentLog::ERROR, "event del fail"); } c->Destruct(); GentAppMgr::Instance()->RetConnect(c); return; } string outstr; int readNum = c->TryRunning(outstr); if(readNum < 0) { if(event_del(&c->ev) == -1) { LOG(GentLog::ERROR, "event del fail"); } c->Destruct(); GentAppMgr::Instance()->RetConnect(c); return; } //continue read //cout << c->rbuf << endl; //write(fd, buf.c_str(),buf.size()); /* event_del(&c->ev); close(fd); free(c->rbuf); free(c); */ }
void GentEvent::Handle(const int fd, const short which, void *arg) { GentConnect *c = static_cast<GentConnect *>(arg); string outstr; int readNum = c->TryRunning(outstr); if(readNum < 0) { event_del(&c->ev); c->Destruct(); GentAppMgr::Instance()->RetConnect(c); return; } if(outstr != "") { //clear connect //c->OutString(outstr); } //continue read //cout << c->rbuf << endl; //write(fd, buf.c_str(),buf.size()); /* event_del(&c->ev); close(fd); free(c->rbuf); free(c); */ }