Use Debug Wrapper Library in socket Connects

This commit is contained in:
René Linder 2023-03-27 16:38:12 +02:00
parent 41881b20cf
commit 743e5132ad
1 changed files with 8 additions and 3 deletions

View File

@ -12,7 +12,7 @@
CompilerIf #PB_Compiler_OS <> #PB_OS_Linux
CompilerError "Only for Linux"
CompilerEndIf
XIncludeFile "../SYS/lhs_sys_debug_wrapper.pbi"
;***********************
;* The SIGPIPE Signal must be Handled Inside / Ignored
#SIGPIPE = 13
@ -57,6 +57,11 @@ DeclareModule lsocket
#PF_INET = 2
#AF_INET = #PF_INET
Global LoggerUUID.s = ""
Global Log_Level_Info = 0
Global Log_Level_Debug = 0
Global Log_Level_Error = 2
Declare CreateSocket(Port.i, Queuelengt.i = 64, Type.i = #SOCK_STREAM, Protocol.i = #AF_INET, BindedIP.s = "127.0.0.1") ; Return Server Socket < 0 Error
Declare WaitSocket(ServerSocket.i) ;Return new SocketID
Declare ReadSocket(ClientSocket.i, *Buffer, Length.i) ;Return Effective Read
@ -97,7 +102,7 @@ Module lsocket
Else
IPAddresse = PeekS(Inet_ntoa_(lsockets_client(Str(Socket))\sin_addr\s_addr), -1, #PB_Ascii)
EndIf
Debug "Requested IP Information:" + IPAddresse
ldl::Logging("Requested IP Information:" + IPAddresse, LoggerUUID, Log_Level_Info)
ProcedureReturn IPAddresse
EndProcedure
@ -110,7 +115,7 @@ Module lsocket
If ClientSID < 0 : FreeMemory(memory) : ProcedureReturn ClientSID : EndIf
MapID = Str(ClientSID)
CopyMemory(memory, lsockets_client(MapID), ClientLength)
Debug "Connected IP:" + PeekS(Inet_ntoa_(lsockets_client(MapID)\sin_addr\s_addr), -1, #PB_Ascii)
ldl::Logging("Connected IP:" + PeekS(Inet_ntoa_(lsockets_client(MapID)\sin_addr\s_addr), -1, #PB_Ascii), LoggerUUID, Log_Level_Info)
FreeMemory(memory)
ProcedureReturn ClientSID
EndProcedure