| | |
| | | int count = 0; |
| | | int i = 0; |
| | | int len = 0; |
| | | int data1, data2; |
| | | char *data_ptr; |
| | | ProcInfo Data_stru; |
| | | ProcZone::iterator proc_iter; |
| | |
| | | |
| | | memcpy(Data_stru.private_info, buf + count, strlen(buf + count) + 1); |
| | | count += strlen(buf + count) + 1; |
| | | |
| | | memcpy(Data_stru.int_info, buf + count, strlen(buf + count) + 1); |
| | | count += strlen(buf + count) + 1; |
| | | |
| | | memcpy(Data_stru.svr_info, buf + count, strlen(buf + count) + 1); |
| | | count += strlen(buf + count) + 1; |
| | | |
| | | } |
| | | |
| | | ProcZone *proc = shm_mm_attach<ProcZone>(SHM_BUS_PROC_MAP_KEY); |
| | |
| | | |
| | | if ((proc_iter = proc->find(key)) != proc->end()) { |
| | | |
| | | data1 = atoi((proc_iter->second).int_info); |
| | | data2 = atoi((proc_iter->second).svr_info); |
| | | BusServerSocket::_data_remove(data1, data2); |
| | | 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); |
| | |
| | | |
| | | free(last_buf); |
| | | } else if (flag == PROC_QUE_STCS) { |
| | | |
| | | SvrTcs *SvrData = shm_mm_attach<SvrTcs>(SHM_BUS_TCS_MAP_KEY); |
| | | ProcZone *proc = shm_mm_attach<ProcZone>(SHM_BUS_PROC_MAP_KEY); |
| | | |
| | | strncpy(buf_temp, topic, topic_size > (sizeof(buf_temp) - 1) ? (sizeof(buf_temp) - 1) : topic_size); |
| | | if ((svr_tcs_iter = SvrData->find(buf_temp)) != SvrData->end()) { |
| | |
| | | |
| | | for(svr_proc_iter = SvrSub_ele->begin(); svr_proc_iter != SvrSub_ele->end(); ++svr_proc_iter) { |
| | | count = *svr_proc_iter; |
| | | if ((proc_iter = proc->find(count)) != proc->end()) { |
| | | count = atoi((proc_iter->second).svr_info); |
| | | } |
| | | |
| | | break; |
| | | } |
| | |
| | | |
| | | return rv; |
| | | } |
| | | |
| | | void BusServerSocket::_data_remove(int val1, int val2) { |
| | | |
| | | 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; |
| | | 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); |
| | | } |
| | | |
| | | } |
| | | |