| | |
| | | bool closeClient = true;
|
| | | if (client->proc != nullptr)
|
| | | {
|
| | | EVClientStub cs;
|
| | | EVClientStub cs(client->recvbuff, client->recvbuff_end);
|
| | | cs.id = client->fd;
|
| | | cs.recvBuff = client->recvbuff;
|
| | | cs.recvBuffSize = client->recvbuff_end;
|
| | | closeClient = !(client->proc(cs));
|
| | |
|
| | | if (cs.sendBuff != nullptr && cs.sendBuffSize > 0)
|
| | | {
|
| | | |
| | | //#todo bufferevent_write
|
| | | size_t writeSize = bufferevent_write(bufev, cs.sendBuff, cs.sendBuffSize);
|
| | | if (writeSize != cs.sendBuffSize)
|
| | | LOG_WARN << "server send truncate " << (cs.sendBuffSize - writeSize) << " bytes";
|
| | |
|
| | | if (cs.deleteSendBuff)
|
| | | delete[] cs.sendBuff;
|
| | |
| | |
|
| | | return EXIT_SUCCESS;
|
| | | }
|
| | |
|
| | | void ev_send_status_packet(EVClientStub& client, EVPStatus::EVPS status)
|
| | | {
|
| | | client.sendBuffSize = sizeof(EVPHeader)+sizeof(EVP_Status);
|
| | | client.sendBuff = new uint8_t[client.sendBuffSize];
|
| | | client.deleteSendBuff = true;
|
| | | |
| | | EVPHeader* evpHeader = new (client.sendBuff) EVPHeader;
|
| | | evpHeader->cmd = EVPCommand::EVPC_STATUS;
|
| | | evpHeader->size = client.sendBuffSize;
|
| | | |
| | | EVP_Status* evpStatus = new (client.sendBuff + sizeof(EVPHeader)) EVP_Status;
|
| | | evpStatus->status = status;
|
| | | }
|