void CClientObjectManager::RemoveFromLists ( CClientObject* pObject ) { if ( m_bCanRemoveFromList ) { ListRemove ( m_Objects, pObject ); } ListRemove ( m_StreamedIn, pObject ); }
void CSocketManager::SocketRemove(CSocket*& pSocket) { ListRemove(vecSockets, pSocket); ListRemove(processQueue, pSocket); pSocket->CloseSocketWithEvent(); ListRemove(deleteList, pSocket); deleteList.push_back(pSocket); }
/* Scheduler function * First check the urgentQueue, if there is something * in it then we remove it from the list and release the * semaphore for it. * If first check doesnt go through we do the exact same check * for the enterQueue list & semaphore * else we release the lock so if anything enters it goes right * ahead. */ void schedule(){ if(ListCount(urgentQueue) > 0){ ListRemove(urgentQueue); V(urgentSem); } else if(ListCount(enterQueue) > 0){ ListRemove(enterQueue); V(enterSem); }else{ isLocked = 0; } }
int coalesce(LIST *free_list, DATA *d) { BLOCK *b1; BLOCK *b2; /* Cursor is after free block just freed */ b2 = ListCurr(free_list); b1 = ListPrev(free_list); /* Cursor is on free block just freed */ /* Fringe case, free memory is at front of free list. * Make b2 the coalesed node and delete b1. */ if (b1 == NULL) { b1 = b2; b2 = ListNext(free_list); if (b1->size + b1->address == b2->address) { b2->size = b2->size + b1->size; b2->address = b2->address - b1->size; ListPrev(free_list); ListRemove(free_list); d->operations_performed++; return 1; } return 0; } else { /* Nodes are never inserted at the end of the list, * so the only case is if the new free node has two * adjacent nodes. */ while (b1 != NULL) { if ((b1->address + b1->size == b2->address)) { b2->address = b1->address; b2->size = b1->size + b2->size; /* Next node has all block data, cur node is junk */ ListRemove(free_list); d->operations_performed++; } b2 = ListCurr(free_list); b1 = ListPrev(free_list); } return 1; } return -1; }
/** * Process an incoming pubrel packet for a socket * @param pack pointer to the publish packet * @param sock the socket on which the packet was received * @return completion code */ int MQTTProtocol_handlePubrels(void* pack, int sock) { Pubrel* pubrel = (Pubrel*)pack; Clients* client = NULL; int rc = TCPSOCKET_COMPLETE; FUNC_ENTRY; client = (Clients*)(ListFindItem(bstate->clients, &sock, clientSocketCompare)->content); Log(LOG_PROTOCOL, 17, NULL, sock, client->clientID, pubrel->msgId); /* look for the message by message id in the records of inbound messages for this client */ if (ListFindItem(client->inboundMsgs, &(pubrel->msgId), messageIDCompare) == NULL) { if (pubrel->header.bits.dup == 0) Log(TRACE_MIN, 3, NULL, "PUBREL", client->clientID, pubrel->msgId); else /* Apparently this is "normal" behaviour, so we don't need to issue a warning */ rc = MQTTPacket_send_pubcomp(pubrel->msgId, &client->net, client->clientID); } else { Messages* m = (Messages*)(client->inboundMsgs->current->content); if (m->qos != 2) Log(TRACE_MIN, 4, NULL, "PUBREL", client->clientID, pubrel->msgId, m->qos); else if (m->nextMessageType != PUBREL) Log(TRACE_MIN, 5, NULL, "PUBREL", client->clientID, pubrel->msgId); else { Publish publish; /* send pubcomp before processing the publications because a lot of return publications could fill up the socket buffer */ rc = MQTTPacket_send_pubcomp(pubrel->msgId, &client->net, client->clientID); publish.header.bits.qos = m->qos; publish.header.bits.retain = m->retain; publish.msgId = m->msgid; publish.topic = m->publish->topic; publish.topiclen = m->publish->topiclen; publish.payload = m->publish->payload; publish.payloadlen = m->publish->payloadlen; Protocol_processPublication(&publish, client); #if !defined(NO_PERSISTENCE) rc += MQTTPersistence_remove(client, PERSISTENCE_PUBLISH_RECEIVED, m->qos, pubrel->msgId); #endif ListRemove(&(state.publications), m->publish); ListRemove(client->inboundMsgs, m); ++(state.msgs_received); } } free(pack); FUNC_EXIT_RC(rc); return rc; }
/** * See if any pending writes have been completed, and cleanup if so. * Cleaning up means removing any publication data that was stored because the write did * not originally complete. */ void MQTTProtocol_checkPendingWrites() { FUNC_ENTRY; if (state.pending_writes.count > 0) { ListElement* le = state.pending_writes.first; while (le) { pending_write* pw = (pending_write*)(le->content); if (Socket_noPendingWrites(pw->socket)) { Clients* client = pw->client; MQTTProtocol_removePublication(pw->p); state.pending_writes.current = le; ListRemove(&(state.pending_writes), le->content); /* does NextElement itself */ le = state.pending_writes.current; /* now we might be able to write the next message in the queue */ MQTTProtocol_processQueued(client); } else ListNextElement(&(state.pending_writes), &le); } } FUNC_EXIT; }
/** * Process an incoming puback packet for a socket * @param pack pointer to the publish packet * @param sock the socket on which the packet was received * @return completion code */ int MQTTProtocol_handlePubacks(void* pack, int sock, Clients* client) { Puback* puback = (Puback*)pack; //Clients* client = (Clients*)(TreeFind(bstate->clients, &sock)->content); int rc = TCPSOCKET_COMPLETE; FUNC_ENTRY; Log(LOG_PROTOCOL, 14, NULL, sock, client->clientID, puback->msgId); /* look for the message by message id in the records of outbound messages for this client */ if (ListFindItem(client->outboundMsgs, &(puback->msgId), messageIDCompare) == NULL) Log(LOG_WARNING, 50, NULL, "PUBACK", client->clientID, puback->msgId); else { Messages* m = (Messages*)(client->outboundMsgs->current->content); if (m->qos != 1) Log(LOG_WARNING, 51, NULL, "PUBACK", client->clientID, puback->msgId, m->qos); else { Log(TRACE_MIN, 4, NULL, client->clientID, puback->msgId); ++(bstate->msgs_sent); bstate->bytes_sent += m->publish->payloadlen; MQTTProtocol_removePublication(m->publish); ListRemove(client->outboundMsgs, m); /* now there is space in the inflight message queue we can process any queued messages */ MQTTProtocol_processQueued(client); } } free(pack); FUNC_EXIT_RC(rc); return rc; }
/** * Continue any outstanding writes for a socket set * @param pwset the set of sockets * @return completion code */ int Socket_continueWrites(fd_set* pwset) { int rc1 = 0; ListElement* curpending = s.write_pending->first; FUNC_ENTRY; while (curpending) { int socket = *(int*)(curpending->content); if (FD_ISSET(socket, pwset) && Socket_continueWrite(socket)) { if (!SocketBuffer_writeComplete(socket)) Log(LOG_SEVERE, -1, "Failed to remove pending write from socket buffer list"); FD_CLR(socket, &(s.pending_wset)); if (!ListRemove(s.write_pending, curpending->content)) { Log(LOG_SEVERE, -1, "Failed to remove pending write from list"); ListNextElement(s.write_pending, &curpending); } curpending = s.write_pending->current; if (writecomplete) (*writecomplete)(socket); } else ListNextElement(s.write_pending, &curpending); } FUNC_EXIT_RC(rc1); return rc1; }
//////////////////////////////////////////////////// // 功能: 结束某一任务的媒体播放,并锁定媒体播放任务 // 输入: // 输出: // 返回: // 说明: //////////////////////////////////////////////////// void MediaTerminateLock(HANDLE htask) { PMEDIA_OBJECT obj; PLIST list; kMutexWait(hMediaMutex); list = &MediaObjList; if(!ListEmpty(list)) { // 获取正在音频任务节点 obj = ListEntry(ListFirst(list), MEDIA_OBJECT, Link); if(obj->hTask == htask) { // 结束当前正在录放的音频任务 obj->Cb.MediaClose(obj->Media, 1); obj->Cb.MediaDestroy(obj->Media); ListRemove(&obj->Link); HandleDestroy(obj->Header.Handle, MEDIA_MAGIC); if(obj->MediaInfo) kfree(obj->MediaInfo); kfree(obj); } } }
void __cdecl CJabberProto::IbbReceiveThread(JABBER_IBB_TRANSFER *jibb) { debugLogA("Thread started: type=ibb_recv"); filetransfer *ft = jibb->ft; jibb->hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); jibb->bStreamClosed = FALSE; jibb->wPacketId = 0; jibb->dwTransferredSize = 0; jibb->state = JIBB_RECVING; WaitForSingleObject(jibb->hEvent, INFINITE); CloseHandle(jibb->hEvent); jibb->hEvent = NULL; if (jibb->state == JIBB_ERROR) m_ThreadInfo->send( XmlNodeIq(_T("set"), SerialNext(), jibb->dstJID) << XCHILDNS(_T("close"), JABBER_FEAT_IBB) << XATTR(_T("sid"), jibb->sid)); if (jibb->bStreamClosed && jibb->dwTransferredSize == ft->dwExpectedRecvFileSize) jibb->state = JIBB_DONE; (this->*jibb->pfnFinal)((jibb->state==JIBB_DONE)?TRUE:FALSE, jibb->ft); jibb->ft = NULL; ListRemove(LIST_FTRECV, jibb->sid); JabberIbbFreeJibb(jibb); }
void ListPurgeFree(HSLIST &hList) { PLISTLINK lpCurr; while ((lpCurr = ListRemove(hList)) != INVALID_SLIST_PTR) SysFree(lpCurr); }
/** * Process an incoming puback packet for a socket * @param pack pointer to the publish packet * @param sock the socket on which the packet was received * @return completion code */ int MQTTProtocol_handlePubacks(void* pack, int sock) { Puback* puback = (Puback*)pack; Clients* client = NULL; int rc = TCPSOCKET_COMPLETE; FUNC_ENTRY; client = (Clients*)(ListFindItem(bstate->clients, &sock, clientSocketCompare)->content); Log(LOG_PROTOCOL, 14, NULL, sock, client->clientID, puback->msgId); /* look for the message by message id in the records of outbound messages for this client */ if (ListFindItem(client->outboundMsgs, &(puback->msgId), messageIDCompare) == NULL) Log(TRACE_MIN, 3, NULL, "PUBACK", client->clientID, puback->msgId); else { Messages* m = (Messages*)(client->outboundMsgs->current->content); if (m->qos != 1) Log(TRACE_MIN, 4, NULL, "PUBACK", client->clientID, puback->msgId, m->qos); else { Log(TRACE_MIN, 6, NULL, "PUBACK", client->clientID, puback->msgId); #if !defined(NO_PERSISTENCE) rc = MQTTPersistence_remove(client, PERSISTENCE_PUBLISH_SENT, m->qos, puback->msgId); #endif MQTTProtocol_removePublication(m->publish); ListRemove(client->outboundMsgs, m); } } free(pack); FUNC_EXIT_RC(rc); return rc; }
int MQTTSProtocol_handlePubacks(void* pack, int sock, char* clientAddr, Clients* client) { int rc = 0; MQTTS_PubAck* puback = (MQTTS_PubAck*)pack; FUNC_ENTRY; Log(LOG_PROTOCOL, 57, NULL, sock, clientAddr, client ? client->clientID : "", puback->msgId); /* look for the message by message id in the records of outbound messages for this client */ if (ListFindItem(client->outboundMsgs, &(puback->msgId), messageIDCompare) == NULL) Log(LOG_WARNING, 50, NULL, "PUBACK", client->clientID, puback->msgId); else { Messages* m = (Messages*)(client->outboundMsgs->current->content); if (m->qos != 1) Log(LOG_WARNING, 51, NULL, "PUBACK", client->clientID, puback->msgId, m->qos); else { Log(TRACE_MAX, 4, NULL, client->clientID, puback->msgId); MQTTProtocol_removePublication(m->publish); ListRemove(client->outboundMsgs, m); /* TODO: msgs counts */ /* (++state.msgs_sent);*/ } } MQTTSPacket_free_packet(pack); FUNC_EXIT_RC(rc); return rc; }
/////////////////////////////////////////////////////////////// // // CResourceFileDownloadManager::UpdatePendingDownloads // // Figure which download group should be running // /////////////////////////////////////////////////////////////// void CResourceFileDownloadManager::UpdatePendingDownloads() { // Get download group to use int iGroup = INVALID_DOWNLOAD_PRIORITY_GROUP; if (!m_ActiveFileDownloadList.empty()) { // Use active download group iGroup = std::max(iGroup, m_ActiveFileDownloadList[0]->GetDownloadPriorityGroup()); } else { // If no resource files being downloaded, find highest pending download group for (auto pResourceFile : m_PendingFileDownloadList) { iGroup = std::max(iGroup, pResourceFile->GetDownloadPriorityGroup()); } } // Start (or add to) matching group std::vector<CDownloadableResource*> pendingListCopy = m_PendingFileDownloadList; for (auto pResourceFile : pendingListCopy) { if (pResourceFile->GetDownloadPriorityGroup() == iGroup) { // Move to active list and begin download ListRemove(m_PendingFileDownloadList, pResourceFile); m_ActiveFileDownloadList.push_back(pResourceFile); BeginResourceFileDownload(pResourceFile, 0); } } }
/////////////////////////////////////////////////////////////////////////// // // CSimPlayerManager::RemoveSimPlayer // // Thread: main // CS should be locked: no // // Delete matching sim player object // /////////////////////////////////////////////////////////////////////////// void CSimPlayerManager::RemoveSimPlayer ( CPlayer* pPlayer ) { LockSimSystem (); // Prevent any sim activity on the sync thread // Check assert ( pPlayer->m_pSimPlayer->m_pRealPlayer == pPlayer ); CSimPlayer* pSim = pPlayer->m_pSimPlayer; // Uninterlnk pSim->m_pRealPlayer = NULL; pPlayer->m_pSimPlayer = NULL; // Move from lists MapRemove ( m_AllSimPlayerMap, pSim ); MapRemove ( m_SocketSimMap, pSim->m_PlayerSocket ); // Remove outgoing sim from all dist lists for ( std::set < CSimPlayer* > ::const_iterator iter = m_AllSimPlayerMap.begin () ; iter != m_AllSimPlayerMap.end (); ++iter ) { CSimPlayer* pOtherSim = *iter; ListRemove ( pOtherSim->m_PuresyncSendListFlat, pSim ); pOtherSim->m_bSendListChanged = true; } SAFE_DELETE( pSim ); UnlockSimSystem (); }
//////////////////////////////////////////////////// // 功能: // 输入: // 输出: // 返回: // 说明: //////////////////////////////////////////////////// int MediaSrvDestroyNotify(void *media) { PLIST head; PLIST n; PMEDIA_OBJECT obj; // kMutexWait(hMediaMutex); head = &MediaObjList; // 搜索指定音频任务 for(n = ListFirst(head); n != head; n = ListNext(n)) { obj = ListEntry(n, MEDIA_OBJECT, Link); if(obj->Media == media) { // 释放当前节点 kdebug(mod_media, PRINT_INFO, "CLOSE Notify: 0x%x\n", obj->Header.Handle); ListRemove(&obj->Link); HandleDestroy(obj->Header.Handle, MEDIA_MAGIC); if(obj->MediaInfo) kfree(obj->MediaInfo); kfree(obj); // 启动下一个等待任务 n = ListFirst(head); if(n != head) { obj = ListEntry(n, MEDIA_OBJECT, Link); if(obj->Mode == MEDIA_MODE_WAIT) { if(obj->Cb.MediaOpen(obj->Media) < 0) { ListRemove(&obj->Link); HandleDestroy(obj->Header.Handle, MEDIA_MAGIC); if(obj->MediaInfo) kfree(obj->MediaInfo); kfree(obj); } } } // kMutexRelease(hMediaMutex); return 0; } } // kMutexRelease(hMediaMutex); return -1; }
/* Delete node n. */ void ListNodeFree (ListNode *n) { if (n) { ListRemove(n); free(n); } }
// return ptr void *ListTrim(LIST *list) { void *item; //list->curr = list->head->prev; ListLast(list); item = ListRemove(list); ListLast(list); return item; }
void Array_Free(struct ListHead * ValueList, AwaResourceType resourceType) { struct ListHead * current, * next; ListForEachSafe(current, next, ValueList) { ArrayItem * valueItem = ListEntry(current, ArrayItem, List); ListRemove(current); Array_FreeItem(valueItem, resourceType); }
bool CLuaCallInHandler::RemoveCallIn(CLuaHandle* lh, const string& ciName) { map<string, CallInList*>::iterator it = callInMap.find(ciName); if (it == callInMap.end()) { return false; } ListRemove(*(it->second), lh); return true; }
/* Monitor Signal * If we have something in the condition variable * list then remove it from that list and add it to * the urguentQueue list and we release the condition * variable semaphore and add to the urguentQueue's semaphore */ void MonSignal(int cv){ if(ListCount(condLists[cv]) > 0){ ListRemove(condLists[cv]); ListAdd(urgentQueue, MyPid()); V(condSems[cv]); P(urgentSem); } }
static void RemoveWatchedDirIfNotReferenced(WatchedDir* wd) { if (IsWatchedDirReferenced(wd)) return; bool ok = ListRemove(&g_watchedDirs, wd); CrashIf(!ok); // memory will be eventually freed in ReadDirectoryChangesNotification() InterlockedIncrement(&gRemovalsPending); QueueUserAPC(StopMonitoringDirAPC, g_threadHandle, (ULONG_PTR)wd); }
static int exec_DeleteImage( filter_t *p_filter, const commandparams_t *p_params, commandparams_t *p_results ) { VLC_UNUSED(p_results); filter_sys_t *p_sys = (filter_sys_t*) p_filter->p_sys; p_sys->b_updated = true; return ListRemove( &p_sys->overlays, p_params->i_id ); }
void CColManager::TakeOutTheTrash ( void ) { vector < CColShape* > ::const_iterator iter = m_TrashCan.begin (); for ( ; iter != m_TrashCan.end (); iter++ ) { ListRemove ( m_List, *iter ); } m_TrashCan.clear (); }
//////////////////////////////////////////////////// // 功能: // 输入: // 输出: // 返回: // 说明: //////////////////////////////////////////////////// int DacClose(HANDLE hdac) { PDAC_DEVICE dac; kMutexWait(hDacMutex); dac = (PDAC_DEVICE)hdac; kdebug(mod_audio, PRINT_INFO, "dac error data number = %d\n",nErrorData); if(dac) { ListRemove(&dac->Link); if(ListEmpty(&DacList)) { //MillinsecoundDelay(20); SetMuteMode(0); //关闭功放 SetPowerAmplifier(0); //MillinsecoundDelay(20); SetMoseCe(0); // 关闭耳机设备 DacHeadphoneClose(); // 关闭DA设备 DacDeviceClose(); // 没有这个耳机会有爆破音. //MillinsecoundDelay(20); } DacDestorySamplerate(dac); //释放resample数据 DacDestoryWsola(hdac); //释放wsola数据 #ifdef DAC_SAVE_PCM { HANDLE fp; fp = kfopen("d:\\pcm.bin","w+b"); kfwrite(dac_buf,1,dac_offset,fp); kfclose(fp); fp = kfopen("d:\\source.bin","w+b"); kfwrite(dac_source_buf,1,dac_source_offset,fp); kfclose(fp); } #endif kfree(dac); kMutexRelease(hDacMutex); return 0; } nErrorData = 0; kMutexRelease(hDacMutex); return -1; }
int MQTTProtocol_handleGets(void* pack, int sock) { Getack* getack = (Getack*)pack; Clients* client = NULL; char* clientid = NULL; int rc = TCPSOCKET_COMPLETE; FUNC_ENTRY; // printf("------>%s, %s, %d\n", __func__, getack->ack_payload.ret_string, getack->ack_payload.ext_cmd); client = (Clients*)(ListFindItem(bstate->clients, &sock, clientSocketCompare)->content); clientid = client->clientID; // Log(LOG_PROTOCOL, 11, NULL, sock, clientid, getack->msgId, get->header.bits.qos, // getack->header.bits.retain, min(20, getack->ext_payloadlen), get->ext_payload); /* here we needn't process some just like publish. only to parse ext ack, get one callback. */ #if 0 if (get->header.bits.qos == 0) Protocol_processPublication(get, client); else if (get->header.bits.qos == 1) { /* send puback before processing the publications because a lot of return publications could fill up the socket buffer */ rc = MQTTPacket_send_puback(publish->msgId, &client->net, client->clientID); /* if we get a socket error from sending the puback, should we ignore the publication? */ Protocol_processPublication(publish, client); } else if (publish->header.bits.qos == 2) { /* store publication in inbound list */ int len; ListElement* listElem = NULL; Messages* m = malloc(sizeof(Messages)); Publications* p = MQTTProtocol_storePublication(publish, &len); m->publish = p; m->msgid = publish->msgId; m->qos = publish->header.bits.qos; m->retain = publish->header.bits.retain; m->nextMessageType = PUBREL; if ( ( listElem = ListFindItem(client->inboundMsgs, &(m->msgid), messageIDCompare) ) != NULL ) { /* discard queued publication with same msgID that the current incoming message */ Messages* msg = (Messages*)(listElem->content); MQTTProtocol_removePublication(msg->publish); ListInsert(client->inboundMsgs, m, sizeof(Messages) + len, listElem); ListRemove(client->inboundMsgs, msg); } else ListAppend(client->inboundMsgs, m, sizeof(Messages) + len); rc = MQTTPacket_send_pubrec(publish->msgId, &client->net, client->clientID); publish->topic = NULL; } MQTTPacket_freePublish(publish); #endif MQTTPacket_freeGet(getack); FUNC_EXIT_RC(rc); return rc; }
/** * Process an incoming pubrel packet for a socket * @param pack pointer to the publish packet * @param sock the socket on which the packet was received * @return completion code */ int MQTTProtocol_handlePubrels(void* pack, int sock, Clients* client) { Pubrel* pubrel = (Pubrel*)pack; //Clients* client = (Clients*)(TreeFind(bstate->clients, &sock)->content); int rc = TCPSOCKET_COMPLETE; FUNC_ENTRY; Log(LOG_PROTOCOL, 17, NULL, sock, client->clientID, pubrel->msgId); /* look for the message by message id in the records of inbound messages for this client */ if (ListFindItem(client->inboundMsgs, &(pubrel->msgId), messageIDCompare) == NULL) { if (pubrel->header.bits.dup == 0) Log(LOG_WARNING, 50, NULL, "PUBREL", client->clientID, pubrel->msgId); /* Apparently this is "normal" behaviour, so we don't need to issue a warning */ rc = MQTTPacket_send_pubcomp(pubrel->msgId, sock, client->clientID); } else { Messages* m = (Messages*)(client->inboundMsgs->current->content); if (m->qos != 2) Log(LOG_WARNING, 51, NULL, "PUBREL", client->clientID, pubrel->msgId, m->qos); else if (m->nextMessageType != PUBREL) Log(LOG_WARNING, 52, NULL, "PUBREL", client->clientID, pubrel->msgId); else { Publish publish; char* saved_clientid = malloc(strlen(client->clientID) + 1); strcpy(saved_clientid, client->clientID); /* send pubcomp before processing the publications because a lot of return publications could fill up the socket buffer */ rc = MQTTPacket_send_pubcomp(pubrel->msgId, sock, client->clientID); publish.header.bits.qos = m->qos; publish.header.bits.retain = m->retain; publish.msgId = m->msgid; publish.topic = m->publish->topic; publish.payload = m->publish->payload; publish.payloadlen = m->publish->payloadlen; ++(bstate->msgs_received); bstate->bytes_received += m->publish->payloadlen; Protocol_processPublication(&publish, client->clientID); /* The client structure might have been removed in processPublication, on error */ if (TreeFind(bstate->clients, &sock) || TreeFind(bstate->disconnected_clients, saved_clientid)) { ListRemove(client->inboundMsgs, m); MQTTProtocol_removePublication(m->publish); } free(saved_clientid); } } free(pack); FUNC_EXIT_RC(rc); return rc; }
void MQTTClient_destroy(MQTTClient* handle) { MQTTClients* m = *handle; FUNC_ENTRY; Thread_lock_mutex(mqttclient_mutex); if (m == NULL) goto exit; if (m->c) { int saved_socket = m->c->net.socket; char* saved_clientid = malloc(strlen(m->c->clientID)+1); strcpy(saved_clientid, m->c->clientID); #if !defined(NO_PERSISTENCE) MQTTPersistence_close(m->c); #endif MQTTClient_emptyMessageQueue(m->c); MQTTProtocol_freeClient(m->c); if (!ListRemove(bstate->clients, m->c)) Log(LOG_ERROR, 0, NULL); else Log(TRACE_MIN, 1, NULL, saved_clientid, saved_socket); free(saved_clientid); } if (m->serverURI) free(m->serverURI); Thread_destroy_sem(m->connect_sem); Thread_destroy_sem(m->connack_sem); Thread_destroy_sem(m->suback_sem); Thread_destroy_sem(m->unsuback_sem); if (!ListRemove(handles, m)) Log(LOG_ERROR, -1, "free error"); *handle = NULL; if (bstate->clients->count == 0) MQTTClient_terminate(); exit: Thread_unlock_mutex(mqttclient_mutex); FUNC_EXIT; }
void Node::ListInsertAfter(Node* what) { ListRemove(); if (!what) return; this->list_next = what->list_next; if (what->list_next) what->list_next->list_prev = this; what->list_next = this; this->list_prev = what; }
/** * Remove stored message data. Opposite of storePublication * @param p stored publication to remove */ void MQTTProtocol_removePublication(Publications* p) { FUNC_ENTRY; if (--(p->refcount) == 0) { free(p->payload); free(p->topic); ListRemove(&(state.publications), p); } FUNC_EXIT; }