diff --git a/src/app/platform_win32/win32_foldhaus_socket.h b/src/app/platform_win32/win32_foldhaus_socket.h index b67107f..eb4ffa5 100644 --- a/src/app/platform_win32/win32_foldhaus_socket.h +++ b/src/app/platform_win32/win32_foldhaus_socket.h @@ -156,7 +156,7 @@ Win32ConnectSocket(platform_socket_manager* Manager, platform_socket* Socket) // If iMode == 0, blocking is enabled // if iMode != 0, non-blocking mode is enabled - u_long iMode = 0; + u_long iMode = 1; Error = ioctlsocket(SocketHandle, FIONBIO, &iMode); if (Error != NO_ERROR) { @@ -244,7 +244,9 @@ Win32SocketPeek(platform_socket_manager* Manager, platform_socket* Socket) char Temp[4]; u32 TempSize = 4; + OutputDebugString("Pre Peek"); s32 BytesQueued = recv(*Win32Sock, Temp, TempSize, Flags); + OutputDebugString("Post Peek"); if (BytesQueued != SOCKET_ERROR) { Result = (u32)BytesQueued; diff --git a/src/app/ss_blumen_lumen/blumen_lumen.cpp b/src/app/ss_blumen_lumen/blumen_lumen.cpp index 8a1aa27..ae89252 100644 --- a/src/app/ss_blumen_lumen/blumen_lumen.cpp +++ b/src/app/ss_blumen_lumen/blumen_lumen.cpp @@ -167,6 +167,8 @@ BlumenLumen_MicListenJob(gs_thread_context* Ctx, u8* UserData) s32 Flags = 0; SocketSend(Data->SocketManager, ListenSocket, Address, Port, Msg, Flags); } + + Assert(!MessageQueue_CanRead(*Data->OutgoingMsgQueue)); } MessageQueue_Clear(Data->OutgoingMsgQueue); @@ -208,7 +210,6 @@ BlumenLumen_LoadPatterns(app_state* State) Patterns_PushPattern(Patterns, Pattern_AllOnMask, PATTERN_MULTITHREADED); Patterns_PushPattern(Patterns, Pattern_BulbMask, PATTERN_MULTITHREADED); Patterns_PushPattern(Patterns, Pattern_VoicePattern, PATTERN_MULTITHREADED); - } internal void diff --git a/src/app/ss_blumen_lumen/message_queue.cpp b/src/app/ss_blumen_lumen/message_queue.cpp index 241b864..bd783a5 100644 --- a/src/app/ss_blumen_lumen/message_queue.cpp +++ b/src/app/ss_blumen_lumen/message_queue.cpp @@ -47,12 +47,13 @@ internal gs_data MessageQueue_Read(blumen_network_msg_queue* Queue) { gs_data Result = {}; - u32 ReadIndex = Queue->ReadHead++; - if (Queue->ReadHead >= BLUMEN_MESSAGE_QUEUE_COUNT) + u32 ReadIndex = Queue->ReadHead; + if (ReadIndex >= BLUMEN_MESSAGE_QUEUE_COUNT) { - Queue->ReadHead = 0; + ReadIndex = 0; } Result = Queue->Buffers[ReadIndex]; + Queue->ReadHead = ReadIndex; return Result; }