Re: [PATCH] Block on oneways



On Wed, 2007-09-26 at 10:11 +0200, Jules Colding wrote:
> Hi,
> 
> I've been thinking about this problem:
> 
> http://www.mail-archive.com/orbit-list gnome org/msg00065.html
> 
> An easy, simple and foolproof way to fix this would be to make all
> oneways block while sending data(*). Another fix would be to put a ref
> on the connection if the send is a oneway, but that fix will be more
> involved and not as straightforward.
> 
> Please comment.

Corrected patch below. This one actually compiles...

-- 
  jules


Index: src/orb/GIOP/giop-send-buffer.c
===================================================================
--- src/orb/GIOP/giop-send-buffer.c     (revision 2025)
+++ src/orb/GIOP/giop-send-buffer.c     (working copy)
@@ -445,11 +445,13 @@
                        gboolean        blocking)
 {
        int retval;
+       gboolean oneway;
        LinkConnection *lcnx = LINK_CONNECTION (cnx);
-       static LinkWriteOpts *non_block = NULL;
+       static LinkWriteOpts *opts = NULL;
 
-       if (!non_block)
-               non_block = link_write_options_new (FALSE);
+       oneway = giop_send_buffer_is_oneway (buf);
+       if (oneway || blocking)
+               opts = link_write_options_new (TRUE);
 
        /* FIXME: if a FRAGMENT, assert the 8 byte tail align,
           &&|| giop_send_buffer_align (buf, 8); */
@@ -457,18 +459,22 @@
        if (g_thread_supported () 
            && lcnx->timeout_msec 
            && !lcnx->timeout_source_id
-           && !giop_send_buffer_is_oneway (buf)) {
+           && !oneway) {
                giop_timeout_add (cnx);
        }
 
+
        retval = link_connection_writev (lcnx, 
                                         buf->iovecs,
                                         buf->num_used, 
-                                        blocking ? NULL : non_block);
-
-       if (!blocking && retval == LINK_IO_QUEUED_DATA)
+                                        opts);
+       if (!(oneway || blocking) && (retval == LINK_IO_QUEUED_DATA))
                retval = 0;
 
+       if (opts) {
+               g_free (opts);
+               opts = NULL;
+       }
        /* FIXME: we need to flag the connection disconnected on fatal error */
 
        return retval;
Index: ChangeLog
===================================================================
--- ChangeLog   (revision 2029)
+++ ChangeLog   (working copy)
@@ -1,3 +1,10 @@
+2007-09-26  Jules Colding  <colding omesc com>
+
+       * src/orb/GIOP/giop-send-buffer.c (giop_send_buffer_write): 
+       Make oneway conenctions block until all data has been send. Will
+       fix this:
+       http://www.mail-archive.com/orbit-list gnome org/msg00065.html
+
 2007-09-25  Jules Colding  <colding omesc com>
 
        * test/timeout-server.c (main): Do not write more into the






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