use blocking sendto() call to possibly eliminate need for nanosleep()
This commit is contained in:
parent
ad3d0a8997
commit
e6f44e22ac
@ -450,18 +450,19 @@ transmit (const struct sockaddr_un *addr,
|
|||||||
socklen_t addr_size,
|
socklen_t addr_size,
|
||||||
const struct GNUNET_MessageHeader *hdr)
|
const struct GNUNET_MessageHeader *hdr)
|
||||||
{
|
{
|
||||||
ssize_t ret;
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i<100; i++)
|
for (unsigned int i = 0; i<100; i++)
|
||||||
{
|
{
|
||||||
ret = GNUNET_NETWORK_socket_sendto (unix_sock,
|
ssize_t ret = sendto (GNUNET_NETWORK_get_fd (unix_sock),
|
||||||
hdr,
|
hdr,
|
||||||
ntohs (hdr->size),
|
ntohs (hdr->size),
|
||||||
(const struct sockaddr *) addr,
|
0 /* no flags => blocking! */,
|
||||||
addr_size);
|
(const struct sockaddr *) addr,
|
||||||
|
addr_size);
|
||||||
if ( (-1 == ret) &&
|
if ( (-1 == ret) &&
|
||||||
(EAGAIN == errno) )
|
(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 */
|
/* Wait a bit, in case client is just too slow */
|
||||||
struct timespec req = {
|
struct timespec req = {
|
||||||
.tv_sec = 0,
|
.tv_sec = 0,
|
||||||
|
@ -516,18 +516,19 @@ transmit (const struct sockaddr_un *addr,
|
|||||||
socklen_t addr_size,
|
socklen_t addr_size,
|
||||||
const struct GNUNET_MessageHeader *hdr)
|
const struct GNUNET_MessageHeader *hdr)
|
||||||
{
|
{
|
||||||
ssize_t ret;
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i<100; i++)
|
for (unsigned int i = 0; i<100; i++)
|
||||||
{
|
{
|
||||||
ret = GNUNET_NETWORK_socket_sendto (unix_sock,
|
ssize_t ret = sendto (GNUNET_NETWORK_get_fd (unix_sock),
|
||||||
hdr,
|
hdr,
|
||||||
ntohs (hdr->size),
|
ntohs (hdr->size),
|
||||||
(const struct sockaddr *) addr,
|
0 /* no flags => blocking! */,
|
||||||
addr_size);
|
(const struct sockaddr *) addr,
|
||||||
|
addr_size);
|
||||||
if ( (-1 == ret) &&
|
if ( (-1 == ret) &&
|
||||||
(EAGAIN == errno) )
|
(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 */
|
/* Wait a bit, in case client is just too slow */
|
||||||
struct timespec req = {
|
struct timespec req = {
|
||||||
.tv_sec = 0,
|
.tv_sec = 0,
|
||||||
|
Loading…
Reference in New Issue
Block a user