Skip to content

Commit 5d16026

Browse files
committed
Tweak handshake time calculation
1 parent a65333c commit 5d16026

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/platforms/macos/daemon/wgsessionmacos.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ void WgSessionMacos::processResult(int op, const QByteArray& buf) const {
8484

8585
case WRITE_TO_NETWORK:
8686
if (m_config.m_hopType == InterfaceConfig::MultiHopExit) {
87-
QByteArray header = mhopHeader(buf);
88-
tunWrite(m_netSocket, header, buf);
87+
tunWrite(m_netSocket, mhopHeader(buf), buf);
8988
} else {
9089
//logger.debug() << name() << "output:" << QByteArray(buf.toBase64());
9190
send(m_netSocket, buf.constData(), buf.length(), MSG_DONTWAIT);
@@ -137,9 +136,9 @@ WireguardUtils::PeerStatus WgSessionMacos::status() const {
137136
auto wgStats = wireguard_stats(m_tunnel);
138137
result.m_rxBytes = wgStats.rx_bytes;
139138
result.m_txBytes = wgStats.tx_bytes;
140-
if (wgStats.time_since_last_handshake > 0) {
141-
qint64 elapsed = wgStats.time_since_last_handshake;
142-
result.m_handshake = (QDateTime::currentSecsSinceEpoch() - elapsed) * 1000;
139+
if (wgStats.time_since_last_handshake >= 0) {
140+
qint64 elapsed = wgStats.time_since_last_handshake * 1000;
141+
result.m_handshake = QDateTime::currentMSecsSinceEpoch() - elapsed;
143142
}
144143
return result;
145144
}

0 commit comments

Comments
 (0)