Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复系统时间跳变引起的长时间无返回 #1004

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions jeromq-core/src/main/java/zmq/SocketBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ public final boolean send(Msg msg, int flags, AtomicBoolean canceled)
// Compute the time when the timeout should occur.
// If the timeout is infinite, don't care.
int timeout = options.sendTimeout;
long end = timeout < 0 ? 0 : (Clock.nowMS() + timeout);
long end = timeout < 0 ? 0 : (Clock.nowNS() / 1000000 + timeout);

// Oops, we couldn't send the message. Wait for the next
// command, process it and try to send the message again.
Expand All @@ -854,7 +854,7 @@ public final boolean send(Msg msg, int flags, AtomicBoolean canceled)
}

if (timeout > 0) {
timeout = (int) (end - Clock.nowMS());
timeout = (int) (end - Clock.nowNS() / 1000000);
if (timeout <= 0) {
errno.set(ZError.EAGAIN);
return false;
Expand Down