- Timestamp:
- 11/28/19 14:40:48 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocol/src/main/java/geniusweb/protocol/session/saop/SAOP.java
r8 r9 23 23 import geniusweb.protocol.CurrentNegoState; 24 24 import geniusweb.protocol.ProtocolException; 25 import geniusweb.protocol.partyconnection. ConnectionWithParty;26 import geniusweb.protocol.partyconnection. ConnectionWithPartyFactory;25 import geniusweb.protocol.partyconnection.ProtocolToPartyConn; 26 import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory; 27 27 import geniusweb.protocol.session.SessionProtocol; 28 28 import geniusweb.protocol.session.SessionSettings; … … 95 95 @Override 96 96 public synchronized void start( 97 ConnectionWithPartyFactory connectionfactory) {97 ProtocolToPartyConnFactory connectionfactory) { 98 98 99 99 try { … … 151 151 */ 152 152 protected synchronized void connect( 153 ConnectionWithPartyFactory connectionfactory)153 ProtocolToPartyConnFactory connectionfactory) 154 154 throws InterruptedException, IOException { 155 155 List<PartyWithProfile> participants = state.getSettings() … … 158 158 .map(parti -> (parti.getParty().getPartyRef())) 159 159 .collect(Collectors.toList()); 160 List< ConnectionWithParty> connections = null;160 List<ProtocolToPartyConn> connections = null; 161 161 log.log(Level.INFO, "SAOP connect " + parties); 162 162 while (connections == null) { … … 218 218 */ 219 219 protected synchronized void setupParties() throws ProtocolException { 220 for ( ConnectionWithPartyconn : state.getConnections()) {220 for (ProtocolToPartyConn conn : state.getConnections()) { 221 221 conn.addListener(action -> actionRequest(conn, action)); 222 222 } 223 223 224 for ( ConnectionWithPartyconnection : state.getConnections()) {224 for (ProtocolToPartyConn connection : state.getConnections()) { 225 225 try { 226 226 sendSettings(connection); … … 239 239 * @throws IOException if party got disconnected 240 240 */ 241 private synchronized void sendSettings( ConnectionWithPartyconnection)241 private synchronized void sendSettings(ProtocolToPartyConn connection) 242 242 throws IOException { 243 243 PartyId partyid = connection.getParty(); … … 261 261 */ 262 262 protected synchronized void actionRequest( 263 final ConnectionWithPartypartyconn, final Action action) {263 final ProtocolToPartyConn partyconn, final Action action) { 264 264 if (action == null) { 265 handleError(partyconn 266 + " did null action, breaching the protocol. Closing session", 267 partyconn.getParty().getName(), null); 265 Throwable err = partyconn.getError(); 266 if (err == null) { 267 err = new ProtocolException("Party sent a null action", 268 partyconn.getParty().getName()); 269 } 270 handleError(partyconn + "Protocol error", 271 partyconn.getParty().getName(), err); 268 272 return; 269 273 } … … 348 352 return; 349 353 Inform finished = new Finished(state.getAgreement()); 350 for ( ConnectionWithPartyconn : state.getConnections()) {354 for (ProtocolToPartyConn conn : state.getConnections()) { 351 355 sendFinish(conn, finished); 352 356 } 353 notify Change(new CurrentNegoState(state));354 } 355 356 private void sendFinish( ConnectionWithPartyconnection, Inform finished) {357 notifyListeners(new CurrentNegoState(state)); 358 } 359 360 private void sendFinish(ProtocolToPartyConn connection, Inform finished) { 357 361 try { 358 362 connection.send(finished);
Note:
See TracChangeset
for help on using the changeset viewer.