I think to have found two bugs in BlitzPlus with the following function:
Function mysql_get_packet(conn.mysqlConn)
If Eof(conn\stream) Then RuntimeError "EOF"
If ReadAvail(conn\stream) = 0 Then ;wait for a packet (the secound packet seems to arrive immediately)
Local timer = CreateTimer(10)
Repeat
WaitTimer timer
Until ReadAvail(conn\stream)
FreeTimer timer
EndIf
Local head = ReadInt(conn\stream) ;packet-header
Local size = head And $00FFFFFF
Local no = convertInt(head And $FF000000)
Local result = CreateBank(size)
ReadBytes result, conn\stream, 0, size
DebugLog "got a packet ("+size+" bytes)"
If size = 0 Then ;result is an empty bank (BankSize(result) = 0) BUT THIS WORKS!!!!!!!!
DebugLog "First byte of packet: "+PeekByte(result, 0)
EndIf
If ReadAvail(conn\stream) <> 0 Then ;this condition should not be true if the packet-header is correct
DebugLog "there is still some read avail ("+ReadAvail(conn\stream)+" bytes)"
Local ra = ReadAvail(conn\stream)
For i=1 To ra ;The loop While ReadAvail(conn\stream) never finishes!
DebugLog ReadByte(conn\stream)
DebugLog ReadAvail(conn\stream)+" bytes left" ;allways the same
Next
Else
DebugLog "There is no read avail any more."
EndIf
Return result
End Function
The first packet arrives perfectly. By trying to receive the secound one, ReadAvail returns 31, but I get a size of 0. But I can read some Bytes of the (empty?) bank "result". After reading some bytes with ReadByte(s) off the stream, the return value of ReadAvail keeps to be 31. I cannot explain both of these two problems, so I think them to be bugs.
Last edited 2011
|