mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-01-19 03:06:26 +00:00
Fix udp sent metric
was only incrementing by 1 for each packet sent
This commit is contained in:
parent
f42841a6ab
commit
8ebe2c563a
@ -453,15 +453,33 @@ public:
|
||||
inline bool udpSend(PhySocket *sock,const struct sockaddr *remoteAddress,const void *data,unsigned long len)
|
||||
{
|
||||
PhySocketImpl &sws = *(reinterpret_cast<PhySocketImpl *>(sock));
|
||||
bool sent = false;
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
int sent = ((long)::sendto(sws.sock,reinterpret_cast<const char *>(data),len,0,remoteAddress,(remoteAddress->sa_family == AF_INET6) ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in)) == (long)len);
|
||||
Metrics::udp_send += sent;
|
||||
return sent;
|
||||
sent = ((long)::sendto(
|
||||
sws.sock,
|
||||
reinterpret_cast<const char *>(data),
|
||||
len,
|
||||
0,
|
||||
remoteAddress,
|
||||
(remoteAddress->sa_family == AF_INET6) ?
|
||||
sizeof(struct sockaddr_in6) :
|
||||
sizeof(struct sockaddr_in)) == (long)len);
|
||||
#else
|
||||
ssize_t sent = ((long)::sendto(sws.sock,data,len,0,remoteAddress,(remoteAddress->sa_family == AF_INET6) ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in)) == (long)len);
|
||||
Metrics::udp_send += sent;
|
||||
return sent;
|
||||
sent = ((long)::sendto(
|
||||
sws.sock,
|
||||
data,
|
||||
len,
|
||||
0,
|
||||
remoteAddress,
|
||||
(remoteAddress->sa_family == AF_INET6) ?
|
||||
sizeof(struct sockaddr_in6) :
|
||||
sizeof(struct sockaddr_in)) == (long)len);
|
||||
#endif
|
||||
if (sent) {
|
||||
Metrics::udp_send += len;
|
||||
}
|
||||
|
||||
return sent;
|
||||
}
|
||||
|
||||
#ifdef __UNIX_LIKE__
|
||||
|
Loading…
Reference in New Issue
Block a user