FreeBSD/sys/dev/iscsi_initiator/isc_soc.c
/*
 | wait for something to arrive.
 | and if the pdu is without errors, process it.
 */
| wait for something to arrive.
| and if the pdu is without errors, process it.
| wait for something to arrive . | and if the pdu is without errors process it .
static int
so_input(isc_session_t *sp)
{
     pduq_t		*pq;
     int		error;
     debug_called(8);
     error = so_getbhs(sp);
     if(error == 0) {
	  pq = pdu_alloc(sp->isc, M_NOWAIT); 
	  if(pq == NULL) { 
	       debug(2, "out of pdus, wait");
	       pq = pdu_alloc(sp->isc, M_WAITOK);  
	  }
	  pq->pdu.ipdu.bhs = sp->bhs;
	  pq->len = sizeof(bhs_t);	
	  error = so_recv(sp, pq);
	  if(error != 0) {
	       error += 0x800; 
	  }
	  else {
	       sp->stats.nrecv++;
	       getbintime(&sp->stats.t_recv);
	       ism_recv(sp, pq);
	  }
     }
     return error;
}
static int so_input ( isc_session_t * sp ) { pduq_t * pq ; int error ; debug_called ( 8 ) ; error = so_getbhs ( sp ) ; if ( error == 0 ) { pq = pdu_alloc ( sp -> isc , M_NOWAIT ) ; if ( pq == NULL ) { debug ( 2 , " " ) ; pq = pdu_alloc ( sp -> isc , M_WAITOK ) ; } pq -> pdu . ipdu . bhs = sp -> bhs ; pq -> len = sizeof ( bhs_t ) ; error = so_recv ( sp , pq ) ; if ( error != 0 ) { error += 0x800 ; } else { sp -> stats . nrecv ++ ; getbintime ( & sp -> stats . t_recv ) ; ism_recv ( sp , pq ) ; } } return error ; }
| wait for something to arrive.
| wait for something to arrive .
/*
      | first read in the iSCSI header
      */ /*
	   | now read the rest.
	   */ // XXX: might cause a deadlock ... // OK to WAIT // so far only the header was read // XXX: just to see the error. // terminal error // XXX: close connection and exit