Ignore:
Timestamp:
11/28/19 14:40:48 (5 years ago)
Author:
bart
Message:

Release 1.1.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocol/src/main/java/geniusweb/protocol/session/saop/SAOP.java

    r8 r9  
    2323import geniusweb.protocol.CurrentNegoState;
    2424import geniusweb.protocol.ProtocolException;
    25 import geniusweb.protocol.partyconnection.ConnectionWithParty;
    26 import geniusweb.protocol.partyconnection.ConnectionWithPartyFactory;
     25import geniusweb.protocol.partyconnection.ProtocolToPartyConn;
     26import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory;
    2727import geniusweb.protocol.session.SessionProtocol;
    2828import geniusweb.protocol.session.SessionSettings;
     
    9595        @Override
    9696        public synchronized void start(
    97                         ConnectionWithPartyFactory connectionfactory) {
     97                        ProtocolToPartyConnFactory connectionfactory) {
    9898
    9999                try {
     
    151151         */
    152152        protected synchronized void connect(
    153                         ConnectionWithPartyFactory connectionfactory)
     153                        ProtocolToPartyConnFactory connectionfactory)
    154154                        throws InterruptedException, IOException {
    155155                List<PartyWithProfile> participants = state.getSettings()
     
    158158                                .map(parti -> (parti.getParty().getPartyRef()))
    159159                                .collect(Collectors.toList());
    160                 List<ConnectionWithParty> connections = null;
     160                List<ProtocolToPartyConn> connections = null;
    161161                log.log(Level.INFO, "SAOP connect " + parties);
    162162                while (connections == null) {
     
    218218         */
    219219        protected synchronized void setupParties() throws ProtocolException {
    220                 for (ConnectionWithParty conn : state.getConnections()) {
     220                for (ProtocolToPartyConn conn : state.getConnections()) {
    221221                        conn.addListener(action -> actionRequest(conn, action));
    222222                }
    223223
    224                 for (ConnectionWithParty connection : state.getConnections()) {
     224                for (ProtocolToPartyConn connection : state.getConnections()) {
    225225                        try {
    226226                                sendSettings(connection);
     
    239239         * @throws IOException if party got disconnected
    240240         */
    241         private synchronized void sendSettings(ConnectionWithParty connection)
     241        private synchronized void sendSettings(ProtocolToPartyConn connection)
    242242                        throws IOException {
    243243                PartyId partyid = connection.getParty();
     
    261261         */
    262262        protected synchronized void actionRequest(
    263                         final ConnectionWithParty partyconn, final Action action) {
     263                        final ProtocolToPartyConn partyconn, final Action action) {
    264264                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);
    268272                        return;
    269273                }
     
    348352                        return;
    349353                Inform finished = new Finished(state.getAgreement());
    350                 for (ConnectionWithParty conn : state.getConnections()) {
     354                for (ProtocolToPartyConn conn : state.getConnections()) {
    351355                        sendFinish(conn, finished);
    352356                }
    353                 notifyChange(new CurrentNegoState(state));
    354         }
    355 
    356         private void sendFinish(ConnectionWithParty connection, Inform finished) {
     357                notifyListeners(new CurrentNegoState(state));
     358        }
     359
     360        private void sendFinish(ProtocolToPartyConn connection, Inform finished) {
    357361                try {
    358362                        connection.send(finished);
Note: See TracChangeset for help on using the changeset viewer.