Beispiel #1
0
/* Terminate any kind of dripback landing. */
void SNetTermDripBack(landing_t *land, fifo_t *fifo)
{
  trace(__func__);

  if (land->type == LAND_dripback1) {
    landing_dripback1_t   *db1 = LAND_SPEC(land, dripback1);

    if (db1->controldesc) {
      snet_record_t *rec = SNetRecCreate(REC_terminate);
      land->worker = SNetThreadGetSelf();
      SNetWrite(&db1->controldesc, rec, false);
      SNetFifoPut(fifo, db1->controldesc);
    } else {
      SNetLandingDone(db1->dripback2);
    }
    SNetFreeLanding(land);
  }
  else if (land->type == LAND_dripback2) {
    landing_dripback2_t   *db2 = LAND_SPEC(land, dripback2);

    if (db2->instdesc) {
      fprintf(stderr, "%s: Premature termination of dripback2\n", __func__);
      SNetFifoPut(fifo, db2->instdesc);
      db2->instdesc = NULL;
    }
    if (db2->outdesc) {
      SNetFifoPut(fifo, db2->outdesc);
      db2->outdesc = NULL;
    }
    SNetFreeLanding(land);
  }
  else {
    assert(0);
  }
}
Beispiel #2
0
/* Terminate any kind of feedback landing. */
void SNetTermFeedback(landing_t *land, fifo_t *fifo)
{
  trace(__func__);
  if (land->type == LAND_feedback1) {
    landing_feedback1_t   *fb1 = LAND_SPEC(land, feedback1);
    landing_feedback3_t   *fb3 = LAND_SPEC(fb1->feedback3, feedback3);

    assert(fb3->terminate == FeedbackInitial);
    if (fb1->outdesc) {
      SNetFifoPut(fifo, fb1->outdesc);
    }
    if (fb1->instdesc) {
      snet_record_t *recdet = SNetRecCreate(REC_detref, -1L, fb1->feedback3, NULL);
      land->worker = SNetThreadGetSelf();
      SNetWrite(&fb1->instdesc, recdet, false);
      SNetFifoPut(fifo, fb1->instdesc);
    }
    SNetLandingDone(fb1->feedback2);
    SNetLandingDone(fb1->feedback4);
    SNetLandingDone(fb1->feedback3);
    SNetFreeLanding(land);
  }
  else if (land->type == LAND_feedback2) {
    landing_feedback2_t   *fb2 = LAND_SPEC(land, feedback2);

    if (fb2->instdesc) {
      SNetFifoPut(fifo, fb2->instdesc);
    }
    SNetLandingDone(fb2->feedback3);
    SNetFreeLanding(land);
  }
  else if (land->type == LAND_feedback3) {
    landing_feedback3_t   *fb3 = LAND_SPEC(land, feedback3);

    SNetLandingDone(fb3->feedback4);
    SNetFreeLanding(land);
  }
  else if (land->type == LAND_feedback4) {
    landing_feedback4_t   *fb4 = LAND_SPEC(land, feedback4);

    if (fb4->outdesc) {
      SNetFifoPut(fifo, fb4->outdesc);
    }
    SNetFreeLanding(land);
  }
  else {
    assert(0);
  }
}