HaxeFoundation / HaxeFoundation/hxcpp
Wrong code for C:\HaxeToolkit\haxe\lib\hxcpp\4,2,1\src\hx\libs\std\Socket.cpp
- Dominant language
- C++
- Stars
- 330
- Forks
- 227
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 18
Description
I found out the code of _hx_std_socket_send method is wrong.
It has no HANDLE_EINTR like _hx_std_socket_send_char for ex. The result is that when I dump a big message, says about 200kb into socket, it keeps throwing Blocked while it should not. If I added label and HANDLE_EINTR like below, it works.
```
int _hx_std_socket_send( Dynamic o, Array buf, int p, int l )
{
SOCKET sock = val_sock(o);
int dlen = buf->length;
if( p < 0 || l < 0 || p > dlen || p + l > dlen )
return 0;
const char *base = (const char *)&buf[0];
hx::EnterGCFreeZone();
POSIX_LABEL(send_data_again);
dlen = send(sock, base + p , l, MSG_NOSIGNAL);
if( dlen == SOCKET_ERROR ){
HANDLE_EINTR(send_data_again);
block_error();
}
hx::ExitGCFreeZone();
return dlen;
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.