Пример #1
0
int ndmda_fh_prepare(struct ndm_session* sess,
                     int vers,
                     int msg,
                     int entry_size,
                     unsigned n_item,
                     unsigned total_size_of_items)
{
  struct ndm_data_agent* da = sess->data_acb;
  struct ndmfhheap* fhh = &da->fhh;
  int fhtype = (vers << 16) + msg;
  int rc;

  rc = ndmfhh_prepare(fhh, fhtype, entry_size, n_item, total_size_of_items);

  if (rc == NDMFHH_RET_OK) return NDMFHH_RET_OK;

  ndmda_fh_flush(sess);

  rc = ndmfhh_prepare(fhh, fhtype, entry_size, n_item, total_size_of_items);

  return rc;
}
Пример #2
0
void
ndmda_data_halt (struct ndm_session *sess, ndmp9_data_halt_reason reason)
{
	struct ndm_data_agent *	da = sess->data_acb;

	da->data_state.state = NDMP9_DATA_STATE_HALTED;
	da->data_state.halt_reason = reason;
	da->data_notify_pending = 1;

	ndmda_fh_flush (sess);

	ndmis_data_close (sess);

	ndmchan_cleanup (&da->formatter_image);
	ndmchan_cleanup (&da->formatter_error);
	ndmchan_cleanup (&da->formatter_wrap);

	/* this needs to be better */
	if (da->formatter_pid) {
		sleep (1);	/* give gtar a chance to stop by itself */
		kill (da->formatter_pid, SIGTERM);
	}
}