]> andersk Git - moira.git/commitdiff
Free returned tuples when possible.
authorwesommer <wesommer>
Tue, 30 Jun 1987 20:04:43 +0000 (20:04 +0000)
committerwesommer <wesommer>
Tue, 30 Jun 1987 20:04:43 +0000 (20:04 +0000)
server/mr_scall.c

index 43b71a6a7ca0f8301b6f5430928881b443f6ec6c..1589426bc960075e4678c0fc91114b59377b22cf 100644 (file)
@@ -6,10 +6,13 @@
  *     Copyright (C) 1987 by the Massachusetts Institute of Technology
  *
  *     $Log$
- *     Revision 1.5  1987-06-26 10:55:53  wesommer
- *     Added sms_access, now paiys attention to return code from 
- *     sms_process_query, sms_check_access.
+ *     Revision 1.6  1987-06-30 20:04:43  wesommer
+ *     Free returned tuples when possible.
  *
+ * Revision 1.5  87/06/26  10:55:53  wesommer
+ * Added sms_access, now paiys attention to return code from 
+ * sms_process_query, sms_check_access.
+ * 
  * Revision 1.4  87/06/21  16:42:00  wesommer
  * Performance work, rearrangement of include files.
  * 
@@ -45,6 +48,7 @@ void
 do_client(cp)
        client *cp;
 {
+       free_rtn_tuples(cp);
        if (OP_STATUS(cp->pending_op) == OP_CANCELLED) {
                (void) sprintf(buf1, "Closed connection (now %d client%s)",
                               nclients-1,
@@ -128,30 +132,68 @@ do_call(cl)
        }
 }
 
+free_rtn_tuples(cp)
+       client *cp;
+{
+       register returned_tuples *temp;
+       for (temp=cp->first; temp && OP_DONE(temp->op); ) {
+               register returned_tuples *t1=temp;
+               temp = t1->next;
+               if (t1 == cp->last) cp->last = NULL;
+#ifdef notdef
+               sms_destroy_reply(t1->retval);
+#endif notdef
+               if (t1->retval) {
+                       register sms_params *p = t1->retval;
+                       if (p->sms_flattened)
+                               free(p->sms_flattened);
+                       if (p->sms_argl)
+                               free(p->sms_argl);
+                       free(p);
+               }
+               delete_operation(t1->op);
+               free(t1);
+       }
+       cp->first = temp;
+}      
+
 retr_callback(argc, argv, p_cp)
        int argc;
        char **argv;
        char *p_cp;
 {
        register client *cp = (client *)p_cp;
-       /* XXX MEM when are these freed?? */
        /*
         * This takes too much advantage of the fact that
         * serialization of the data happens during the queue operation.
         */
        sms_params *arg_tmp = (sms_params *)db_alloc(sizeof(sms_params));
+       returned_tuples *tp = (returned_tuples *)
+               db_alloc(sizeof(returned_tuples));
+       
        OPERATION op_tmp = create_operation();
 
 #ifdef notdef                  /* We really don't want this logged */
        com_err(whoami, 0, "Returning next data:");
        log_args(argc, argv);
 #endif notdef
+       tp->op = op_tmp;
+       tp->retval = arg_tmp;
+       tp->next = NULL;
        
        arg_tmp->sms_status = SMS_MORE_DATA;
        arg_tmp->sms_argc = argc;
        arg_tmp->sms_argv = argv;
        arg_tmp->sms_flattened = (char *)NULL;
        arg_tmp->sms_argl = (int *)NULL;
+
+       if (cp->last) {
+               cp->last->next = tp;
+               cp->last = tp;
+       } else {
+               cp->last = cp->first = tp;
+       }
+       
        reset_operation(op_tmp);
        initialize_operation(op_tmp, sms_start_send, (char *)arg_tmp,
                             (int (*)())NULL);
This page took 0.050537 seconds and 5 git commands to generate.