move patient_write to share.h because it now has multiple users
[ust.git] / ustd / ustd.c
index b6b362f4fcc3a44eb5c0cba3e84e6eeb49efaa60..4a9a14ecdc8d29a9bd9e3b0f56b64d93ae13e5a1 100644 (file)
@@ -35,6 +35,7 @@
 #include "ustd.h"
 #include "localerr.h"
 #include "ustcomm.h"
+#include "share.h"
 
 /* return value: 0 = subbuffer is finished, it won't produce data anymore
  *               1 = got subbuffer successfully
@@ -112,11 +113,6 @@ int get_subbuffer(struct buffer_info *buf)
                retval = -1;
                goto end;
        }
-       else if(result == 0) {
-               DBG("app died while being traced");
-               retval = GET_SUBBUF_DIED;
-               goto end;
-       }
 
        result = sscanf(received_msg, "%as %ld", &rep_code, &buf->consumed_old);
        if(result != 2 && result != 1) {
@@ -203,30 +199,6 @@ end:
        return retval;
 }
 
-/* This write is patient because it restarts if it was incomplete.
- */
-
-ssize_t patient_write(int fd, const void *buf, size_t count)
-{
-       const char *bufc = (const char *) buf;
-       int result;
-
-       for(;;) {
-               result = write(fd, bufc, count);
-               if(result <= 0) {
-                       return result;
-               }
-               count -= result;
-               bufc += result;
-
-               if(count == 0) {
-                       break;
-               }
-       }
-
-       return bufc-(const char *)buf;
-}
-
 void decrement_active_buffers(void *arg)
 {
        pthread_mutex_lock(&active_buffers_mutex);
@@ -278,6 +250,7 @@ void *consumer_thread(void *arg)
                        WARN("application died while putting subbuffer");
                        /* FIXME: probably need to skip the first subbuffer in finish_consuming_dead_subbuffer */
                        finish_consuming_dead_subbuffer(buf);
+                       break;
                }
                else if(result == PUT_SUBBUF_OK) {
                }
This page took 0.023587 seconds and 4 git commands to generate.