Networking debugging

This commit is contained in:
PS 2021-04-08 10:44:40 -07:00
parent 2190051274
commit d0b54e92ef
3 changed files with 9 additions and 5 deletions

View File

@ -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;

View File

@ -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

View File

@ -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;
}