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

fix hang on Win if server is not alive or died #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pfpulux
Copy link

@pfpulux pfpulux commented Mar 27, 2024

A client on win hang for a long time if the server is not alive. This PR use trySend on Win to fix this. Also replace TaintedStringwith string and add small adjustment suggest by nimsuggest.

src/redis.nim Outdated
@@ -126,7 +126,11 @@ proc managedSend(
r: Redis | AsyncRedis, data: string
): Future[void] {.multisync.} =
when r is Redis:
r.socket.send(data)
when defined(windows):
if not r.socket.tryRecv(data):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would tryRecv + close be equivalent to send?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for that, should be trySend(, see the update below

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants