| 708 | } |
| 709 | |
| 710 | int64_t send(struct sockaddr_in addr, uint8_t *data, int len) { |
| 711 | SendPack *sendPack = new SendPack(); |
| 712 | |
| 713 | struct timeval now; |
| 714 | gettimeofday(&now, NULL); |
| 715 | sendPack->sessionid = (((int64_t) now.tv_sec) * 1000 * 1000) + now.tv_usec; |
| 716 | |
| 717 | sendPack->toAddr = addr; |
| 718 | sendPack->len = len; |
| 719 | sendPack->data = new uint8_t[len]; |
| 720 | memcpy(sendPack->data, data, len); |
| 721 | |
| 722 | sendQueue.push(sendPack); |
| 723 | write(m_pipefd[1], &m_pipefd[1], sizeof(int)); |
| 724 | |
| 725 | return sendPack->sessionid; |
| 726 | } |
| 727 | |
| 728 | |
| 729 | }; |