Hi,

I've been thinking about this problem:

http://www.mail-archive.com/[email protected]/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.

Thanks,
  jules

(*) It doesn't look like link_connection_writev() even looks at the link
options before eventually returning  LINK_IO_QUEUED_DATA at line 1180...




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,15 @@
                        gboolean        blocking)
 {
        int retval;
+       gboolean oneway;
        LinkConnection *lcnx = LINK_CONNECTION (cnx);
-       static LinkWriteOpts *non_block = NULL;
+       static LinkWriteOpts opts;
 
-       if (!non_block)
-               non_block = link_write_options_new (FALSE);
+       oneway = giop_send_buffer_is_oneway (buf);
+       if (oneway || blocking)
+               opts.block_on_write = TRUE;
+       else 
+               opts.block_on_write = FALSE;
 
        /* FIXME: if a FRAGMENT, assert the 8 byte tail align,
           &&|| giop_send_buffer_align (buf, 8); */
@@ -457,16 +461,16 @@
        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 (!opts.block_on_write && (retval == LINK_IO_QUEUED_DATA))
                retval = 0;
 
        /* FIXME: we need to flag the connection disconnected on fatal error */
Index: ChangeLog
===================================================================
--- ChangeLog   (revision 2029)
+++ ChangeLog   (working copy)
@@ -1,3 +1,10 @@
+2007-09-26  Jules Colding  <[EMAIL PROTECTED]>
+
+       * 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/[email protected]/msg00065.html
+
 2007-09-25  Jules Colding  <[EMAIL PROTECTED]>
 
        * test/timeout-server.c (main): Do not write more into the



_______________________________________________
orbit-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/orbit-list

Reply via email to