Changes between Version 10 and Version 11 of Old/NodeHandler/Broadcast


Ignore:
Timestamp:
Apr 10, 2006, 10:49:17 PM (18 years ago)
Author:
sswami
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Old/NodeHandler/Broadcast

    v10 v11  
    108108messages through a pipe instead of a socket. Also, access to the pipe will be serialized. The
    109109Communication Server is a 2-threaded process.
     110
     111'''Note: '''
     112This is a first test implementation. The final implementation will have multiple TCP
     113connections - one for each NodeAgent. Also, all issues relating to message size will be
     114investigated.
    110115
    111116'''NodeHandler Communication Server'''
     
    131136       END IF
    132137       Setup ACK list
    133        WHILE (ACK_LIST_INCOMPLETE)
     138       set flag = true
     139       WHILE (flag)
     140         lock(ACK_list)
     141         IF (ACK_LIST_COMPLETE)
     142            flag = false
     143            return
     144         END IF
    134145         IF (TIMEOUT)
     146           lock(pipe_access)
    135147           send(pipe) "TIMEOUT" to NodeHandler
     148           unlock(pipe_access)
    136149           break
    137150         END IF
     
    140153       END WHILE
    141154    END FUNCTION
    142  
     155
     156     
    1431572. Receiving Thread
    144158   ================
    145    create a new TCP connection
     159   create a new TCP socket
    146160   bind
    147161   listen(400)
     
    153167        update ACK list
    154168        IF (ACK_LIST_COMPLETE)
     169           unlock(ACK_list)
    155170           send "WAKEUP" to main thread
    156171        ELSE IF (ACK_LIST_INCOMPLETE && TIMEOUT)
     172           unlock(ACK_list)
    157173           send "TIMEOUT" to main thread
    158174        END IF
    159         unlock(ACK_list)
     175       
    160176     ELSE IF (message == EVENT)
     177        lock(pipe_access)
    161178        send(pipe) message to NodeHandler
     179        unlock(pipe_access)
    162180     END IF
     181     close(connection)
    163182   END WHILE
    164183}}}
     
    1701891. MAIN THREAD
    171190   ===========
     191   create a TCP connection
    172192   create the new Broadcast Client socket 
    173    create the receiving thread            /* this thread will send TCP message */
     193   create the receiving thread and pass TCP sockfd  /* this thread will send TCP message */
    174194    WHILE (true)
    175195       message = recvfrom(socket)         /* receive message from NodeHandler*/
    176196       IF (message for this NodeAgent)
    177197          construct ACK message
    178           send(pipe) ACK message to receiving thread
     198          send ACK message to the NodeHandler COmmunication Server
    179199          send(pipe) message to the NodeAgent
    180200       END IF
     
    1832032. RECEIVING THREAD
    184204   ================
    185    create a TCP connection
     205   
    186206   WHILE (true)
    187        recv(pipe) message from the NodeAgent / Main Thread
     207       recv(pipe) message from the NodeAgent
    188208       Send message to the NodeHandler COmmunication Server
    189209   END WHILE