From: John Hodge Date: Tue, 8 Nov 2011 06:35:11 +0000 (+0800) Subject: Usermode/AxWin3 - Debugging user reception of messages X-Git-Tag: rel0.14~135 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=19dae42a211f5dff3471b7a53cf1de3b9518d330;p=tpg%2Facess2.git Usermode/AxWin3 - Debugging user reception of messages --- diff --git a/Usermode/Applications/axwin3_src/libaxwin3.so_src/main.c b/Usermode/Applications/axwin3_src/libaxwin3.so_src/main.c index 2432fd88..3c7d109a 100644 --- a/Usermode/Applications/axwin3_src/libaxwin3.so_src/main.c +++ b/Usermode/Applications/axwin3_src/libaxwin3.so_src/main.c @@ -8,6 +8,7 @@ #include #include "include/internal.h" #include "include/ipc.h" +#include // === CODE === int SoMain(void *Base, int argc, const char *argv[], const char **envp) @@ -25,8 +26,13 @@ void AxWin3_MainLoop(void) while(!bExit) { msg = AxWin3_int_GetIPCMessage(); - + if(!msg) continue; + // TODO: Handle message + _SysDebug("oh look, a message (Type=%i, Window=%i, Len=%i)", + msg->ID, msg->Window, msg->Size); + + free(msg); } } diff --git a/Usermode/Applications/axwin3_src/libaxwin3.so_src/msg.c b/Usermode/Applications/axwin3_src/libaxwin3.so_src/msg.c index c3c6be75..3b6a3ba5 100644 --- a/Usermode/Applications/axwin3_src/libaxwin3.so_src/msg.c +++ b/Usermode/Applications/axwin3_src/libaxwin3.so_src/msg.c @@ -129,6 +129,7 @@ tAxWin_IPCMessage *AxWin3_int_GetIPCMessage(void) // Check if the message came from the server if(tid != giConnectionNum) { + _SysDebug("%i byte message from %i", len, tid); // If not, pass the buck (or ignore) if( gAxWin3_MessageCallback ) gAxWin3_MessageCallback(tid, len); @@ -139,7 +140,11 @@ tAxWin_IPCMessage *AxWin3_int_GetIPCMessage(void) // If it's from the server, allocate a buffer and return it ret = malloc(len); - if(ret == NULL) return NULL; + if(ret == NULL) { + _SysDebug("malloc() failed, ignoring message"); + SysGetMessage(NULL, GETMSG_IGNORE); + return NULL; + } SysGetMessage(NULL, ret); break; }