OSSP CVS Repository

ossp - Check-in [2935]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 2935
Date: 2002-Nov-29 15:27:44 (local)
2002-Nov-29 14:27:44 (UTC)
User:mlelstv
Branch:
Comment: add assertions to check internal state with scheduler direction

PR: Submitted by: Reviewed by: Approved by: Obtained from:

Tickets:
Inspections:
Files:
ossp-pkg/sio/sio_hello.c      1.11 -> 1.12     11 inserted, 3 deleted

ossp-pkg/sio/sio_hello.c 1.11 -> 1.12

--- sio_hello.c  2002/11/29 13:00:18     1.11
+++ sio_hello.c  2002/11/29 14:27:44     1.12
@@ -246,7 +246,7 @@
 #define GOTO(s, c) do { my->state = (s); rc = (c); } while(0)
 
 static
-sio_rc_t hello_protocol(sio_t *sio, private_t *my, int isoutput)
+sio_rc_t hello_protocol(sio_t *sio, private_t *my, int isoutput, sio_rc_t orc)
 {
     sio_rc_t rc = SIO_ERR_INT;
     int good;
@@ -255,6 +255,8 @@
 
     case INIT:
 
+        assert(orc == SIO_SCHED_UP);
+
         /*
          * save origin (input, output) so that
          * we can complete correctly after handshake
@@ -280,6 +282,8 @@
 
     case PROMPTING:
 
+        assert(orc == SIO_SCHED_CROSS || orc == SIO_SCHED_LOOP);
+
         assert(isoutput == 1);
         /*
          *  only called on output stream
@@ -297,6 +301,8 @@
 
     case PROMPTED:
 
+        assert(orc == SIO_SCHED_DOWN);
+
         assert(isoutput == 1);
         /*
          * only called on output stream
@@ -313,6 +319,8 @@
 
     case WAIT:
 
+        assert(orc == SIO_SCHED_CROSS || orc == SIO_SCHED_DOWN);
+
         assert(isoutput == 0);
         /*
          * only called on input stream
@@ -393,13 +401,13 @@
 static
 sio_rc_t hello_input(sio_t *sio, al_t *al, void *u, sio_rc_t orc)
 {
-    return hello_protocol(sio, (private_t *)u, 0);
+    return hello_protocol(sio, (private_t *)u, 0, orc);
 }
 
 static
 sio_rc_t hello_output(sio_t *sio, al_t *al, void *u, sio_rc_t orc)
 {
-    return hello_protocol(sio, (private_t *)u, 1);
+    return hello_protocol(sio, (private_t *)u, 1, orc);
 }
 
 sio_module_t sio_module_hello = {

CVSTrac 2.0.1