[gnio] In non-blocking mode, wait before sending data



commit 71c9b8215c28d0a88d0c30ee2a9da4de093db572
Author: Alexander Larsson <alexl redhat com>
Date:   Tue May 5 11:00:00 2009 +0200

    In non-blocking mode, wait before sending data
---
 test/server.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/test/server.c b/test/server.c
index 68499b4..28ddc37 100644
--- a/test/server.c
+++ b/test/server.c
@@ -195,6 +195,14 @@ main (int argc,
 
       while (to_send > 0)
 	{
+	  if (non_blocking &&
+	      !g_socket_condition_wait (recv_socket, G_IO_OUT, NULL, &error))
+	    {
+	      g_printerr ("send condition wait error: %s\n",
+			  error->message);
+	      return 1;
+	    }
+
 	  if (use_udp)
 	    {
 	      ov.size = to_send;
@@ -213,6 +221,7 @@ main (int argc,
 				   G_IO_ERROR,
 				   G_IO_ERROR_WOULD_BLOCK))
 		{
+		  g_print ("socket send would block, handling\n");
 		  g_error_free (error);
 		  error = NULL;
 		  continue;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]