mirror of
https://github.com/ml-explore/mlx.git
synced 2025-06-25 09:51:17 +08:00
Change the send message size
This commit is contained in:
parent
e5354fcddb
commit
e94f0028c3
@ -170,10 +170,17 @@ struct GroupImpl {
|
||||
}
|
||||
|
||||
void send(const char* buf, size_t len, int dst) {
|
||||
ssize_t r = sendto(
|
||||
socket_fd_, buf, len, 0, peers_[dst].sockaddr(), peers_[dst].len);
|
||||
if (r < 0) {
|
||||
throw std::runtime_error("Send failed.");
|
||||
while (len > 0) {
|
||||
size_t l = std::min(len, 8192ul);
|
||||
ssize_t r = sendto(
|
||||
socket_fd_, buf, l, 0, peers_[dst].sockaddr(), peers_[dst].len);
|
||||
if (r <= 0) {
|
||||
std::ostringstream msg;
|
||||
msg << "Send of " << l << " bytes failed (errno: " << errno << ")";
|
||||
throw std::runtime_error(msg.str());
|
||||
}
|
||||
len -= l;
|
||||
buf += l;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user