On 29/04/2011 21:52, Davi Arnaut wrote:
> On 4/29/11 12:10 PM, Rafal Somla wrote:
>> + /*
>> + Code for testing the logic for sending the first client payload.
>> + A fake data of length given by environment variable TEST_PACKET_LENGTH
>> + (or default 255 bytes) is sent to the server. First 2 bytes of the
>> + payload contain its total length (LSB first). The length of test data
>> + is limited to 2048 bytes.
>> + Upon receiving test data, server will check that data is correct and
>> + refuse connection. If server detects data errors it will crash on
>> + assertion.
>> + This code is executed if debug flag "winauth_first_packet_test" is
>> + set, e.g. using client option:
>> + --debug="d,winauth_first_packet_test"
>> + The same debug flag must be enabled in the server, e.g. using
>> + statement:
>> + SET GLOBAL debug= '+d,winauth_first_packet_test';
>> + */
>> + static byte test_buf;
> This is made non-reentrant / thread-unsafe on purpose?
Yes, kind of... This is code intended not for normal usage but for
testing protocol logic. It is to be executed from tests where the
execution context is highly controlled anyway. So I think it is
justified to make it simple and easy and don't bother with dynamic
allocation and freeing of the memory. So thought the reviewer, apparently.