example/protocol/Protocol.c
static int
accept_handler(INKCont contp, INKEvent event, void *edata)
{
  INKCont txn_sm;
  INKMutex pmutex;
  int lock;

  switch (event) {
  case INK_EVENT_NET_ACCEPT:
    /* Create a new mutex for the TxnSM, which is going
       to handle the incoming request. */
    pmutex = (INKMutex) INKMutexCreate();
    txn_sm = (INKCont) TxnSMCreate(pmutex, (INKVConn) edata, server_port);

    /* This is no reason for not grabbing the lock.
       So skip the routine which handle LockTry failure case. */
    if (INKMutexLockTry(pmutex, &lock) == INK_SUCCESS) {
      INKContCall(txn_sm, 0, NULL);
      INKMutexUnlock(pmutex);
    }
    break;

  default:
    /* Something wrong with the network, if there are any 
       pending NetAccept, cancel them. */
    if (pending_action && !INKActionDone(pending_action))
      INKActionCancel(pending_action);

    INKContDestroy(contp);
    break;
  }

  return INK_EVENT_NONE;
}
/* When the handle is called, the net_vc is returned. */
When the handle is called, the net_vc is returned.
When the handle is called the net_vc is returned .
static int
accept_handler(INKCont contp, INKEvent event, void *edata)
{
  INKCont txn_sm;
  INKMutex pmutex;
  int lock;
  switch (event) {
  case INK_EVENT_NET_ACCEPT:
    pmutex = (INKMutex) INKMutexCreate();
    txn_sm = (INKCont) TxnSMCreate(pmutex, (INKVConn) edata, server_port);
    if (INKMutexLockTry(pmutex, &lock) == INK_SUCCESS) {
      INKContCall(txn_sm, 0, NULL);
      INKMutexUnlock(pmutex);
    }
    break;
  default:
    if (pending_action && !INKActionDone(pending_action))
      INKActionCancel(pending_action);
    INKContDestroy(contp);
    break;
  }
  return INK_EVENT_NONE;
}
static int accept_handler ( INKCont contp , INKEvent event , void * edata ) { INKCont txn_sm ; INKMutex pmutex ; int lock ; switch ( event ) { case INK_EVENT_NET_ACCEPT : pmutex = ( INKMutex ) INKMutexCreate ( ) ; txn_sm = ( INKCont ) TxnSMCreate ( pmutex , ( INKVConn ) edata , server_port ) ; if ( INKMutexLockTry ( pmutex , & lock ) == INK_SUCCESS ) { INKContCall ( txn_sm , 0 , NULL ) ; INKMutexUnlock ( pmutex ) ; } break ; default : if ( pending_action && ! INKActionDone ( pending_action ) ) INKActionCancel ( pending_action ) ; INKContDestroy ( contp ) ; break ; } return INK_EVENT_NONE ; }
When the handle is called, the net_vc is returned.
When the handle is called the net_vc is returned .
/* Create a new mutex for the TxnSM, which is going
       to handle the incoming request. */ /* This is no reason for not grabbing the lock.
       So skip the routine which handle LockTry failure case. */ /* Something wrong with the network, if there are any 
       pending NetAccept, cancel them. */