void
dnsreq::fail (int err)
{
  assert (err);
  if (!error)
    error = err;
  if (constructed)
    readreply (NULL);
  else {
    remove ();
    delaycb (0, wrap (this, &dnsreq::readreply, (dnsparse *) NULL));
  }
}
Exemplo n.º 2
0
static int
readSerialShimType()
{
	char	typeSerialShim[ 12 ];
	int	ival, shimset;

	memset( &typeSerialShim[ 0 ], 0, sizeof( typeSerialShim ) );

	if (shimPort < 0) {
		ival = initSerialShims();
		if (ival < 0 || ival == TIMEOUT)
		  return( -1 );
	}

    if (pShimMutex != NULL)
    {
        semTake(pShimMutex,WAIT_FOREVER); /* protect shim serial comm */
    }
    else
    {
      errLogRet(LOGIT,debugInfo,"readSerialShimType: Mutex Pointer NULL\n");
      return(-1);
    }
	shimset = 0;
	clearport( shimPort );
	pputchr( shimPort, 'I');
	if (cmdecho( shimPort, CMD))
	{
	    /* No resposnse--must be different type serial shim */
	    shimset = readOmtSerialShimType(); /* Try OMT shims */
	}else{
	    /* Responded to "I" cmd */
	    ival = readreply( shimPort, 300,
			     &typeSerialShim[ 0 ], sizeof( typeSerialShim ) );
	    if (ival == 0)
            {
	       shimset = atoi( &typeSerialShim[ 0 ] );
            }
	    else
	       shimset = -1;
	}

	semGive(pShimMutex);
	return( shimset );
}