mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-15 07:43:50 +00:00
Updated metadata
This commit is contained in:
@@ -3029,6 +3029,8 @@ char *ILibChain_GetMetaDataFromDescriptorSetEx(void *chain, fd_set *inr, fd_set
|
||||
fd_set emptyset; FD_ZERO(&emptyset);
|
||||
int selectTimeout = UPNP_MAX_WAIT * 1000;
|
||||
int f;
|
||||
size_t tmp;
|
||||
|
||||
while (node != NULL && (module = (ILibChain_Link*)ILibLinkedList_GetDataFromNode(node)) != NULL)
|
||||
{
|
||||
if (module->PreSelectHandler != NULL)
|
||||
@@ -3064,7 +3066,7 @@ char *ILibChain_GetMetaDataFromDescriptorSetEx(void *chain, fd_set *inr, fd_set
|
||||
}
|
||||
for (f = 0; f < scount; ++f)
|
||||
{
|
||||
len += sprintf_s(retStr + len, ILibMemory_Size(retStr) - len, " FD[%d] (R: %d, W: %d, E: %d) => %s\n", (int)slist[f], FD_ISSET(slist[f], inr), FD_ISSET(slist[f], inw), FD_ISSET(slist[f], ine), ((ILibChain_Link*)module)->MetaData);
|
||||
len += sprintf_s(retStr + len, ILibMemory_Size(retStr) - len, " FD[%d] (R: %d, W: %d, E: %d) => %s\n", (int)slist[f], FD_ISSET(slist[f], inr), FD_ISSET(slist[f], inw), FD_ISSET(slist[f], ine), ((ILibChain_Link*)module)->QueryHandler != NULL ? ((ILibChain_Link*)module)->QueryHandler(chain, module, (int)slist[f], &tmp) : ((ILibChain_Link*)module)->MetaData);
|
||||
}
|
||||
|
||||
#else
|
||||
@@ -3072,7 +3074,7 @@ char *ILibChain_GetMetaDataFromDescriptorSetEx(void *chain, fd_set *inr, fd_set
|
||||
{
|
||||
if (FD_ISSET(f, &readset) || FD_ISSET(f, &writeset) || FD_ISSET(f, &errorset))
|
||||
{
|
||||
len += sprintf_s(retStr + len, ILibMemory_Size(retStr) - len, " FD[%d] (R: %d, W: %d, E: %d) => %s\n", f, FD_ISSET(f, inr), FD_ISSET(f, inw), FD_ISSET(f, ine), ((ILibChain_Link*)module)->MetaData);
|
||||
len += sprintf_s(retStr + len, ILibMemory_Size(retStr) - len, " FD[%d] (R: %d, W: %d, E: %d) => %s\n", f, FD_ISSET(f, inr), FD_ISSET(f, inw), FD_ISSET(f, ine), ((ILibChain_Link*)module)->QueryHandler != NULL ? ((ILibChain_Link*)module)->QueryHandler(chain, module, f, &tmp) : ((ILibChain_Link*)module)->MetaData);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -342,6 +342,8 @@ int ILibIsRunningOnChainThread(void* chain);
|
||||
typedef void(*ILibChain_PreSelect)(void* object, fd_set *readset, fd_set *writeset, fd_set *errorset, int* blocktime);
|
||||
typedef void(*ILibChain_PostSelect)(void* object, int slct, fd_set *readset, fd_set *writeset, fd_set *errorset);
|
||||
typedef void(*ILibChain_Destroy)(void* object);
|
||||
typedef char*(*ILibChain_QueryData)(void* chain, void *object, int fd, size_t *dataLen);
|
||||
|
||||
typedef void(*ILibChain_DestroyEvent)(void *chain, void *user);
|
||||
typedef void(*ILibChain_StartEvent)(void *chain, void *user);
|
||||
typedef void*(*ILibChain_Link_GetUserMemory)(void *ChainLinkObject, int *len);
|
||||
@@ -365,6 +367,7 @@ int ILibIsRunningOnChainThread(void* chain);
|
||||
ILibChain_PreSelect PreSelectHandler;
|
||||
ILibChain_PostSelect PostSelectHandler;
|
||||
ILibChain_Destroy DestroyHandler;
|
||||
ILibChain_QueryData QueryHandler;
|
||||
void* ParentChain;
|
||||
void* ExtraMemoryPtr;
|
||||
char* MetaData;
|
||||
|
||||
@@ -172,6 +172,30 @@ ILibProcessPipe_Pipe ILibProcessPipe_Process_GetStdOut(ILibProcessPipe_Process p
|
||||
BOOL ILibProcessPipe_Process_OnExit(void *chain, HANDLE event, ILibWaitHandle_ErrorStatus errors, void* user);
|
||||
#else
|
||||
void ILibProcessPipe_Process_ReadHandler(void* user);
|
||||
int ILibProcessPipe_Manager_OnQuery_comparer(void *j1, void *j2)
|
||||
{
|
||||
ILibProcessPipe_PipeObject *pj = (ILibProcessPipe_PipeObject*)j1;
|
||||
int fd = (int)(uintptr_t)j2;
|
||||
|
||||
if (pj->mPipe_ReadEnd == fd) { return(0); }
|
||||
return(1);
|
||||
}
|
||||
char * ILibProcessPipe_Manager_OnQuery(void *chain, void *object, int fd, size_t *dataLen)
|
||||
{
|
||||
ILibProcessPipe_Manager_Object *man = (ILibProcessPipe_Manager_Object*)object;
|
||||
char *ret = ((ILibChain_Link*)object)->MetaData;
|
||||
int i;
|
||||
*dataLen = strnlen_s(((ILibChain_Link*)object)->MetaData, 1024);
|
||||
|
||||
void *node = ILibLinkedList_GetNode_Search(man->ActivePipes, ILibProcessPipe_Manager_OnQuery_comparer, (void*)(uintptr_t)fd);
|
||||
if (node != NULL)
|
||||
{
|
||||
ILibProcessPipe_PipeObject *pj = (ILibProcessPipe_PipeObject*)ILibLinkedList_GetDataFromNode(node);
|
||||
*dataLen = strnlen_s(pj->metadata, 1024);
|
||||
ret = pj->metadata;
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
void ILibProcessPipe_Manager_OnPreSelect(void* object, fd_set *readset, fd_set *writeset, fd_set *errorset, int* blocktime)
|
||||
{
|
||||
ILibProcessPipe_Manager_Object *man = (ILibProcessPipe_Manager_Object*)object;
|
||||
@@ -241,6 +265,7 @@ ILibProcessPipe_Manager ILibProcessPipe_Manager_Create(void *chain)
|
||||
#ifndef WIN32
|
||||
retVal->ChainLink.PreSelectHandler = &ILibProcessPipe_Manager_OnPreSelect;
|
||||
retVal->ChainLink.PostSelectHandler = &ILibProcessPipe_Manager_OnPostSelect;
|
||||
retVal->ChainLink.QueryHandler = ILibProcessPipe_Manager_OnQuery;
|
||||
#endif
|
||||
retVal->ChainLink.DestroyHandler = &ILibProcessPipe_Manager_OnDestroy;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user