You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the _uv_tcp_t connection has multiple messages to be read or a single message with a \n, the call UV_TCP_ReadLine fails with the following message:
<ceu-libuv path>/include/uv/stream.ceu:101] runtime error: bug found
For the name of the call (ReadLine) I assume this code should return a single line in each call. The following code illustrates the bug:
server:
#include "uv/uv.ceu"
#include "uv/tcp.ceu"
code/await UV_TCP_Server_Handler (var& _uv_tcp_t client) -> int
do
loop do
vector[] byte buffer;
await UV_TCP_ReadLine(&client, &buffer);
_printf ("[server] received: %s\n", &&buffer[0]);
buffer = [] .. "PONG\n";
await UV_TCP_Write (&client, &buffer);
#if 0 //Changing to 1 causes the client to fail
await UV_TCP_Write (&client, &buffer);
#endif
end
end
#include "uv/tcp-server.ceu"
await UV_TCP_Server ("0.0.0.0", 8888, 128);
client:
#include "uv/uv.ceu"
#include "uv/tcp.ceu"
event& (void) connected;
var& _uv_tcp_t tcp_;
watching UV_TCP_Connect("0.0.0.0", 8888) -> (&tcp_, &connected)
do
await connected;
vector []byte buffer = [] .. "PING\n";
await UV_TCP_Write(&tcp_, &buffer);
await 1s;
await UV_TCP_ReadLine(&tcp_, &buffer); //If the server sends two consecutive messages, the client fails here
_printf ("%s\n", &&buffer[0]);
end
escape 0;
The text was updated successfully, but these errors were encountered:
Currently, UV_Stream_ReadLine expects an end of line exactly at the end of the stream.
It is designed for simple protocols in which peers send a line and block.
If the other peer can send arbitrary messages, you have to use UV_Stream_Read and parse the stream yourself.
If the
_uv_tcp_t
connection has multiple messages to be read or a single message with a\n
, the callUV_TCP_ReadLine
fails with the following message:<ceu-libuv path>/include/uv/stream.ceu:101] runtime error: bug found
For the name of the call (ReadLine) I assume this code should return a single line in each call. The following code illustrates the bug:
server:
client:
The text was updated successfully, but these errors were encountered: