Changes between Version 10 and Version 11 of Old/NodeHandler/Broadcast
- Timestamp:
- Apr 10, 2006, 10:49:17 PM (19 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Old/NodeHandler/Broadcast
v10 v11 108 108 messages through a pipe instead of a socket. Also, access to the pipe will be serialized. The 109 109 Communication Server is a 2-threaded process. 110 111 '''Note: ''' 112 This is a first test implementation. The final implementation will have multiple TCP 113 connections - one for each NodeAgent. Also, all issues relating to message size will be 114 investigated. 110 115 111 116 '''NodeHandler Communication Server''' … … 131 136 END IF 132 137 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 134 145 IF (TIMEOUT) 146 lock(pipe_access) 135 147 send(pipe) "TIMEOUT" to NodeHandler 148 unlock(pipe_access) 136 149 break 137 150 END IF … … 140 153 END WHILE 141 154 END FUNCTION 142 155 156 143 157 2. Receiving Thread 144 158 ================ 145 create a new TCP connection159 create a new TCP socket 146 160 bind 147 161 listen(400) … … 153 167 update ACK list 154 168 IF (ACK_LIST_COMPLETE) 169 unlock(ACK_list) 155 170 send "WAKEUP" to main thread 156 171 ELSE IF (ACK_LIST_INCOMPLETE && TIMEOUT) 172 unlock(ACK_list) 157 173 send "TIMEOUT" to main thread 158 174 END IF 159 unlock(ACK_list)175 160 176 ELSE IF (message == EVENT) 177 lock(pipe_access) 161 178 send(pipe) message to NodeHandler 179 unlock(pipe_access) 162 180 END IF 181 close(connection) 163 182 END WHILE 164 183 }}} … … 170 189 1. MAIN THREAD 171 190 =========== 191 create a TCP connection 172 192 create the new Broadcast Client socket 173 create the receiving thread 193 create the receiving thread and pass TCP sockfd /* this thread will send TCP message */ 174 194 WHILE (true) 175 195 message = recvfrom(socket) /* receive message from NodeHandler*/ 176 196 IF (message for this NodeAgent) 177 197 construct ACK message 178 send (pipe) ACK message to receiving thread198 send ACK message to the NodeHandler COmmunication Server 179 199 send(pipe) message to the NodeAgent 180 200 END IF … … 183 203 2. RECEIVING THREAD 184 204 ================ 185 create a TCP connection205 186 206 WHILE (true) 187 recv(pipe) message from the NodeAgent / Main Thread207 recv(pipe) message from the NodeAgent 188 208 Send message to the NodeHandler COmmunication Server 189 209 END WHILE