[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-exchange] 01/02: use blocking sendto() call to possibly eliminate
From: |
gnunet |
Subject: |
[taler-exchange] 01/02: use blocking sendto() call to possibly eliminate need for nanosleep() |
Date: |
Wed, 06 Jan 2021 10:11:57 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository exchange.
commit e6f44e22aca3e6aecb5f74e4c32ee347857701c2
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Jan 6 10:07:12 2021 +0100
use blocking sendto() call to possibly eliminate need for nanosleep()
---
src/util/taler-helper-crypto-eddsa.c | 15 ++++++++-------
src/util/taler-helper-crypto-rsa.c | 15 ++++++++-------
2 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/src/util/taler-helper-crypto-eddsa.c
b/src/util/taler-helper-crypto-eddsa.c
index 8e05302c..7839ac84 100644
--- a/src/util/taler-helper-crypto-eddsa.c
+++ b/src/util/taler-helper-crypto-eddsa.c
@@ -450,18 +450,19 @@ transmit (const struct sockaddr_un *addr,
socklen_t addr_size,
const struct GNUNET_MessageHeader *hdr)
{
- ssize_t ret;
-
for (unsigned int i = 0; i<100; i++)
{
- ret = GNUNET_NETWORK_socket_sendto (unix_sock,
- hdr,
- ntohs (hdr->size),
- (const struct sockaddr *) addr,
- addr_size);
+ ssize_t ret = sendto (GNUNET_NETWORK_get_fd (unix_sock),
+ hdr,
+ ntohs (hdr->size),
+ 0 /* no flags => blocking! */,
+ (const struct sockaddr *) addr,
+ addr_size);
if ( (-1 == ret) &&
(EAGAIN == errno) )
{
+ /* _Maybe_ with blocking sendto(), this should no
+ longer be needed; still keeping it just in case. */
/* Wait a bit, in case client is just too slow */
struct timespec req = {
.tv_sec = 0,
diff --git a/src/util/taler-helper-crypto-rsa.c
b/src/util/taler-helper-crypto-rsa.c
index 9539277c..ae75e5a2 100644
--- a/src/util/taler-helper-crypto-rsa.c
+++ b/src/util/taler-helper-crypto-rsa.c
@@ -516,18 +516,19 @@ transmit (const struct sockaddr_un *addr,
socklen_t addr_size,
const struct GNUNET_MessageHeader *hdr)
{
- ssize_t ret;
-
for (unsigned int i = 0; i<100; i++)
{
- ret = GNUNET_NETWORK_socket_sendto (unix_sock,
- hdr,
- ntohs (hdr->size),
- (const struct sockaddr *) addr,
- addr_size);
+ ssize_t ret = sendto (GNUNET_NETWORK_get_fd (unix_sock),
+ hdr,
+ ntohs (hdr->size),
+ 0 /* no flags => blocking! */,
+ (const struct sockaddr *) addr,
+ addr_size);
if ( (-1 == ret) &&
(EAGAIN == errno) )
{
+ /* _Maybe_ with blocking sendto(), this should no
+ longer be needed; still keeping it just in case. */
/* Wait a bit, in case client is just too slow */
struct timespec req = {
.tv_sec = 0,
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.