X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FApplications%2Faxwin3_src%2FWM%2Fipc_acess.c;h=26f60a243f7c85790dd39d1a13a8b1b1c0543b29;hb=69597a188bf638485ea83b7608430f92080c1855;hp=1d6e344654525c0bb6997556a8ef3b277cad4f12;hpb=14852edafde643ebc07078152455d1cacf485ecd;p=tpg%2Facess2.git diff --git a/Usermode/Applications/axwin3_src/WM/ipc_acess.c b/Usermode/Applications/axwin3_src/WM/ipc_acess.c index 1d6e3446..26f60a24 100644 --- a/Usermode/Applications/axwin3_src/WM/ipc_acess.c +++ b/Usermode/Applications/axwin3_src/WM/ipc_acess.c @@ -17,8 +17,8 @@ // === PROTOTYPES === void IPC_Init(void); -void IPC_FillSelect(int *nfds, fd_set *set); -void IPC_HandleSelect(fd_set *set); +void IPC_FillSelect(int *nfds, fd_set *set, fd_set *err_set); +void IPC_HandleSelect(fd_set *set, fd_set *err_set); int IPC_Type_Datagram_GetSize(const void *Ident); int IPC_Type_Datagram_Compare(const void *Ident1, const void *Ident2); void IPC_Type_Datagram_Send(const void *Ident, size_t Length, const void *Data); @@ -75,18 +75,20 @@ void _setfd(int fd, int *nfds, fd_set *set) } } -void IPC_FillSelect(int *nfds, fd_set *set) +void IPC_FillSelect(int *nfds, fd_set *set, fd_set *err_set) { _setfd(giNetworkFileHandle, nfds, set); _setfd(giIPCPipeHandle, nfds, set); for( int i = 0; i < giIPC_ClientCount; i ++ ) { - if( gIPC_Clients[i] && gIPC_Clients[i]->IPCType == &gIPC_Type_IPCPipe ) + if( gIPC_Clients[i] && gIPC_Clients[i]->IPCType == &gIPC_Type_IPCPipe ) { _setfd( *(int*)(gIPC_Clients[i]->Ident), nfds, set ); + _setfd( *(int*)(gIPC_Clients[i]->Ident), nfds, err_set ); + } } } -void IPC_HandleSelect(fd_set *set) +void IPC_HandleSelect(fd_set *set, fd_set *err_set) { if( giNetworkFileHandle != -1 && FD_ISSET(giNetworkFileHandle, set) ) { @@ -127,6 +129,12 @@ void IPC_HandleSelect(fd_set *set) } IPC_Handle( gIPC_Clients[i], len, (void*)staticBuf ); } + if( FD_ISSET(fd, err_set) ) + { + // Client disconnected + IPC_int_DropClient(gIPC_Clients[i]); + _SysClose(fd); + } } }