| | |
| | | |
| | | data1 = atoi((proc_iter->second).int_info); |
| | | data2 = atoi((proc_iter->second).svr_info); |
| | | BusServerSocket::_data_remove(data1, data2); |
| | | BusServerSocket::_data_remove(data1); |
| | | BusServerSocket::_data_remove(data2); |
| | | BusServerSocket::_data_remove(key); |
| | | len = (sizeof(buf_temp) - 1) > strlen((proc_iter->second).proc_id) ? strlen((proc_iter->second).proc_id) : (sizeof(buf_temp) - 1); |
| | | strncpy(buf_temp, (proc_iter->second).proc_id, len); |
| | | proc->erase(proc_iter); |
| | |
| | | _proxy_reg(topics, head.topic_size, content, head.content_size, key, flag); |
| | | |
| | | } |
| | | else if (strncmp(buf, "request", strlen("request")) == 0) { |
| | | sprintf(send_buf, "%4d", key); |
| | | strncpy(send_buf + 4, buf, (sizeof(send_buf) - 4) >= (strlen(buf) + 1) ? strlen(buf) : (sizeof(send_buf) - 4)); |
| | | |
| | | rv = shm_sendto(shm_socket, send_buf, strlen(send_buf) + 1, key); |
| | | if(rv != 0) { |
| | | logger->error( "BusServerSocket::_run_proxy_ : requst answer fail!\n"); |
| | | } |
| | | } |
| | | else if(strcmp(action, "stop") == 0) { |
| | | free(buf); |
| | | break; |
| | |
| | | return rv; |
| | | } |
| | | |
| | | void BusServerSocket::_data_remove(int val1, int val2) { |
| | | void BusServerSocket::_data_remove(int val) { |
| | | |
| | | int i; |
| | | LockFreeQueue<shm_packet_t> *queue = NULL; |
| | | hashtable_t *hashtable = mm_get_hashtable(); |
| | | |
| | | void *data_ptr1 = hashtable_get(hashtable, val1); |
| | | void *data_ptr2 = hashtable_get(hashtable, val2); |
| | | if (data_ptr1 != NULL) { |
| | | if (data_ptr1 != (void *)1) { |
| | | queue = (LockFreeQueue<shm_packet_t> *)data_ptr1; |
| | | void *data_ptr = hashtable_get(hashtable, val); |
| | | if (data_ptr != NULL) { |
| | | if (data_ptr != (void *)1) { |
| | | queue = (LockFreeQueue<shm_packet_t> *)data_ptr; |
| | | queue->close(); |
| | | for (i = 0; i < queue->size(); i++) { |
| | | mm_free((*queue)[i].buf); |
| | |
| | | sleep(1); |
| | | } |
| | | |
| | | hashtable_remove(hashtable, val1); |
| | | } |
| | | |
| | | if (data_ptr2 != NULL) { |
| | | if (data_ptr2 != (void *)1) { |
| | | queue = (LockFreeQueue<shm_packet_t> *)data_ptr2; |
| | | queue->close(); |
| | | for (i = 0; i < queue->size(); i++) { |
| | | mm_free((*queue)[i].buf); |
| | | } |
| | | sleep(1); |
| | | } |
| | | |
| | | hashtable_remove(hashtable, val2); |
| | | hashtable_remove(hashtable, val); |
| | | } |
| | | |
| | | } |