Example #1
0
static void bulk_request_handler(void *token, void *buf, int nbytes, int arg) {
  #if DEBUG
  uint32_t *recvdbuf = (uint32_t *)buf;
  #endif
  #if VERBOSE
    printf("%i: bulk_request_handler(). starting...\n", myproc); fflush(stdout);
  #endif

  assert(arg == 666);
  assert(nbytes == size % AM_MaxLong() || nbytes == AM_MaxLong());
  assert(buf == ((uint8_t *)VMseg) + 100);
  /* assert(done < 2*nummsgs); */

  #if DEBUG
    /*  verify the result */
    { int i;
      for (i = 0; i < nbytes/4; i++) {
        if (recvdbuf[i] != (uint32_t)i) 
          AMX_FatalErr("%i: ERROR: mismatched data recvdbuf[%i]=%i\n", myproc, i, (int)recvdbuf[i]);
      }
    }
  #endif

  #if VERBOSE
    printf("%i: bulk_request_handler(). sending reply...\n", myproc); fflush(stdout);
  #endif


  AM_Safe(AM_Reply0(token, BULK_REP_HANDLER));
  done++;
}
Example #2
0
static void ping_request_handler(void *token) {
  numleft--;

  #if VERBOSE
    printf("%i: ping_request_handler(). sending reply...\n", myproc); fflush(stdout);
  #endif

  AM_Safe(AM_Reply0(token, PING_REP_HANDLER));
}