Changeset 103055 in vbox for trunk/src/libs
- Timestamp:
- Jan 25, 2024 10:03:13 AM (12 months ago)
- Location:
- trunk/src/libs/xpcom18a4/ipc/ipcd/daemon/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/ipc/ipcd/daemon/src/ipcClient.h
r102062 r103055 39 39 #define ipcClientUnix_h__ 40 40 41 #include <iprt/list.h> 41 42 #include <iprt/socket.h> 42 43 … … 56 57 { 57 58 public: 59 /** Node for the list of clients. */ 60 RTLISTNODE NdClients; 58 61 bool m_fUsed; 59 62 uint32_t m_idPoll; -
trunk/src/libs/xpcom18a4/ipc/ipcd/daemon/src/ipcd.cpp
r102249 r103055 104 104 // broadcast 105 105 // 106 for (int i=0; i<ipcClientCount; ++i) 107 IPC_SendMsg(&ipcClients[i], msg->Clone()); 106 ipcClient *pIt; 107 RTListForEachCpp(&g_LstIpcClients, pIt, ipcClient, NdClients) 108 { 109 IPC_SendMsg(pIt, msg->Clone()); 110 } 108 111 delete msg; 109 112 return PR_SUCCESS; … … 128 131 Log(("IPC_NotifyClientUp: clientID=%d\n", client->ID())); 129 132 130 for (int i=0; i<ipcClientCount; ++i) { 131 if (&ipcClients[i] != client) 132 IPC_SendMsg(&ipcClients[i], 133 ipcClient *pIt; 134 RTListForEachCpp(&g_LstIpcClients, pIt, ipcClient, NdClients) 135 { 136 if (pIt != client) 137 IPC_SendMsg(pIt, 133 138 new ipcmMessageClientState(client->ID(), IPCM_CLIENT_STATE_UP)); 134 139 } … … 140 145 Log(("IPC_NotifyClientDown: clientID=%d\n", client->ID())); 141 146 142 for (int i=0; i<ipcClientCount; ++i) { 143 if (&ipcClients[i] != client) 144 IPC_SendMsg(&ipcClients[i], 147 ipcClient *pIt; 148 RTListForEachCpp(&g_LstIpcClients, pIt, ipcClient, NdClients) 149 { 150 if (pIt != client) 151 IPC_SendMsg(pIt, 145 152 new ipcmMessageClientState(client->ID(), IPCM_CLIENT_STATE_DOWN)); 146 153 } … … 161 168 { 162 169 // linear search OK since number of clients should be small 163 for (int i = 0; i < ipcClientCount; ++i) { 164 if (ipcClients[i].ID() == clientID) 165 return &ipcClients[i]; 170 ipcClient *pIt; 171 RTListForEachCpp(&g_LstIpcClients, pIt, ipcClient, NdClients) 172 { 173 if (pIt->ID() == clientID) 174 return pIt; 166 175 } 167 176 return NULL; … … 172 181 { 173 182 // linear search OK since number of clients should be small 174 for (int i = 0; i < ipcClientCount; ++i) { 175 if (ipcClients[i].HasName(name)) 176 return &ipcClients[i]; 183 ipcClient *pIt; 184 RTListForEachCpp(&g_LstIpcClients, pIt, ipcClient, NdClients) 185 { 186 if (pIt->HasName(name)) 187 return pIt; 177 188 } 178 189 return NULL; … … 183 194 { 184 195 Assert(func); 185 for (int i = 0; i < ipcClientCount; ++i) { 186 if (func(closure, &ipcClients[i], ipcClients[i].ID()) == PR_FALSE) 196 ipcClient *pIt; 197 RTListForEachCpp(&g_LstIpcClients, pIt, ipcClient, NdClients) 198 { 199 if (func(closure, pIt, pIt->ID()) == PR_FALSE) 187 200 break; 188 201 } -
trunk/src/libs/xpcom18a4/ipc/ipcd/daemon/src/ipcdPrivate.h
r102047 r103055 39 39 #define ipcdPrivate_h__ 40 40 41 #include <iprt/cdefs.h> 42 #include <iprt/list.h> 43 41 44 class ipcClient; 42 45 … … 47 50 #define IPC_MAX_CLIENTS 10000 48 51 49 // 50 // array of connected clients 51 // 52 extern ipcClient *ipcClients; 53 extern int ipcClientCount; 52 /** List of connected IPC clients. */ 53 extern RTLISTANCHOR g_LstIpcClients; 54 54 55 55 // -
trunk/src/libs/xpcom18a4/ipc/ipcd/daemon/src/ipcdUnix.cpp
r102345 r103055 265 265 // declared in ipcdPrivate.h 266 266 // 267 ipcClient *ipcClients = NULL;268 intipcClientCount = 0;267 DECL_HIDDEN_DATA(RTLISTANCHOR) g_LstIpcClients; 268 static int ipcClientCount = 0; 269 269 270 270 // … … 296 296 if (RT_SUCCESS(vrc)) 297 297 { 298 RTListAppend(&g_LstIpcClients, &ipcClientArray[i].NdClients); 298 299 ipcClientCount++; 299 300 return 0; … … 314 315 AssertRC(vrc); RT_NOREF(vrc); 315 316 317 RTListNodeRemove(&ipcClientArray[idClient].NdClients); 316 318 ipcClientArray[idClient].Finalize(); 317 319 --ipcClientCount; … … 323 325 static void PollLoop(RTPOLLSET hPollSet, int fdListen) 324 326 { 325 ipcClients = ipcClientArray;327 RTListInit(&g_LstIpcClients); 326 328 327 329 for (;;)
Note:
See TracChangeset
for help on using the changeset viewer.