Author: dbkr
Date: 2006-07-23 17:27:55 +0000 (Sun, 23 Jul 2006)
New Revision: 9736

Modified:
   trunk/apps/Freemail/docs/spec/spec.tex
   trunk/apps/Freemail/src/freemail/MailSite.java
   trunk/apps/Freemail/src/freemail/MessageSender.java
   trunk/apps/Freemail/src/freemail/OutboundContact.java
   trunk/apps/Freemail/src/freemail/SingleAccountWatcher.java
   trunk/apps/Freemail/src/freemail/fcp/HighLevelFCPClient.java
Log:
A few minor bits before starting on message exchange.


Modified: trunk/apps/Freemail/docs/spec/spec.tex
===================================================================
--- trunk/apps/Freemail/docs/spec/spec.tex      2006-07-23 15:50:59 UTC (rev 
9735)
+++ trunk/apps/Freemail/docs/spec/spec.tex      2006-07-23 17:27:55 UTC (rev 
9736)
@@ -116,9 +116,9 @@
 Then he might insert an acknowledgement to the key: \\
 \\
 \\
-SSK at 
AJoZbUvGkXlAJwI\-jdbu9BLPhpIXBu6\-w6nGwKYBnMfNLi,ACEgE1uUIzJdC\-Xcsz1yjgW45u\-Az-KuMrXBFYG\-U8maqc/ack-1
 \\
+SSK at 
AJoZbUvGkXlAJwI\-jdbu9BLPhpIXBu6\-w6nGwKYBnMfNLi,ACEgE1uUIzJdC\-Xcsz1yjgW45u\-Az-KuMrXBFYG\-U8maqc/ack-657488664753
 \\
 \\
-The data that Bob publishes to this key is irrelevant - its mere existance in 
the network is sufficient to assert Bob's reciept of the message.
+The data that Bob publishes to this key is irrelevant - its mere existance in 
the network is sufficient to assert Bob's reciept of the message. If Alice has, 
for whatever reason, not received a CTS message from Bob, her receipt of a 
message ack should additionally be treated as receipt of a CTS message.

 \appendix


Modified: trunk/apps/Freemail/src/freemail/MailSite.java
===================================================================
--- trunk/apps/Freemail/src/freemail/MailSite.java      2006-07-23 15:50:59 UTC 
(rev 9735)
+++ trunk/apps/Freemail/src/freemail/MailSite.java      2006-07-23 17:27:55 UTC 
(rev 9736)
@@ -67,6 +67,8 @@

                int actualslot = cli.SlotInsert(mailpage, key, minslot, 
"/"+MAILPAGE);

+               if (actualslot < 0) return -1;
+               
                this.accprops.put("mailsite.slot", new 
Integer(actualslot).toString());

                return actualslot;

Modified: trunk/apps/Freemail/src/freemail/MessageSender.java
===================================================================
--- trunk/apps/Freemail/src/freemail/MessageSender.java 2006-07-23 15:50:59 UTC 
(rev 9735)
+++ trunk/apps/Freemail/src/freemail/MessageSender.java 2006-07-23 17:27:55 UTC 
(rev 9736)
@@ -101,7 +101,10 @@
                for (i = 0; i < contacts.length; i++) {
                        OutboundContact outboundcontact = new 
OutboundContact(accdir, contacts[i]);

-                       outboundcontact.checkCTS();
+                       try {
+                               outboundcontact.checkCTS();
+                       } catch (OutboundContactFatalException obctfe) {
+                       }
                }
        }


Modified: trunk/apps/Freemail/src/freemail/OutboundContact.java
===================================================================
--- trunk/apps/Freemail/src/freemail/OutboundContact.java       2006-07-23 
15:50:59 UTC (rev 9735)
+++ trunk/apps/Freemail/src/freemail/OutboundContact.java       2006-07-23 
17:27:55 UTC (rev 9736)
@@ -61,14 +61,10 @@
                this.contactfile = new PropsFile(ctfile);
        }

-       public void checkCTS() {
+       public void checkCTS() throws OutboundContactFatalException {
                String status = this.contactfile.get("status");
                if (status == null) {
-                       try {
-                               this.init();
-                       } catch (OutboundContactFatalException obctfe) {
-                               // impossible
-                       }
+                       this.init();
                }

                if (status.equals("cts-received")) {
@@ -78,11 +74,7 @@

                        String ctsksk = this.contactfile.get("ctsksk");
                        if (ctsksk == null) {
-                               try {
-                                       this.init();
-                               } catch (OutboundContactFatalException obctfe) {
-                                       // impossible
-                               }
+                               this.init();
                        }

                        HighLevelFCPClient fcpcli = new HighLevelFCPClient();
@@ -95,11 +87,7 @@

                                if (senttime == null || 
Long.parseLong(senttime) > System.currentTimeMillis() + CTS_WAIT_TIME) {
                                        // yes, send another RTS
-                                       try {
-                                               this.init();
-                                       } catch (OutboundContactFatalException 
obctfe) {
-                                               // impossible
-                                       }
+                                       this.init();
                                }

                        } else {
@@ -108,11 +96,7 @@
                                this.contactfile.put("status", "cts-received");
                        }
                } else {
-                       try {
-                               this.init();
-                       } catch (OutboundContactFatalException obctfe) {
-                               // impossible
-                       }
+                       this.init();
                }
        }

@@ -127,6 +111,7 @@
                // don't wait for an ack before inserting the message, but be 
ready to insert it again
                // if the ack never arrives
                if (status.equals("rts-sent")) return true;
+               if (status.equals("cts-received")) return true;
                return false;
        }


Modified: trunk/apps/Freemail/src/freemail/SingleAccountWatcher.java
===================================================================
--- trunk/apps/Freemail/src/freemail/SingleAccountWatcher.java  2006-07-23 
15:50:59 UTC (rev 9735)
+++ trunk/apps/Freemail/src/freemail/SingleAccountWatcher.java  2006-07-23 
17:27:55 UTC (rev 9736)
@@ -13,20 +13,19 @@
        private final MessageBank mb;
        private final NIMFetcher nf;
        private final RTSFetcher rtsf;
+       private long mailsite_last_upload;
+       private final PropsFile accprops;

        SingleAccountWatcher(File accdir) {
+               this.accprops = AccountManager.getAccountFile(accdir);
                File contacts_dir = new File(accdir, CONTACTS_DIR);
                File inbound_dir = new File(contacts_dir, INBOUND_DIR);
+               this.mailsite_last_upload = 0;

                if (!inbound_dir.exists()) {
                        inbound_dir.mkdir();
                }

-               // TODO: do this in the loop, periodically
-               PropsFile accprops = AccountManager.getAccountFile(accdir);
-               MailSite ms = new MailSite(accprops);
-               ms.Publish();
-               
                this.mb = new MessageBank(accdir.getName());

                File nimdir = new File(contacts_dir, AccountManager.NIMDIR);
@@ -36,8 +35,9 @@
                        this.nf = null;
                }

-               this.rtsf = new RTSFetcher("KSK@"+accprops.get("rtskey")+"-", 
inbound_dir, accdir);

+               this.rtsf = new 
RTSFetcher("KSK@"+this.accprops.get("rtskey")+"-", inbound_dir, accdir);
+               
                //this.mf = new MailFetcher(this.mb, inbound_dir, 
Freemail.getFCPConnection());
        }

@@ -45,6 +45,13 @@
                while (true) {
                        long start = System.currentTimeMillis();

+                       if (System.currentTimeMillis() > 
this.mailsite_last_upload + MAILSITE_UPLOAD_INTERVAL) {
+                               MailSite ms = new MailSite(this.accprops);
+                               if (ms.Publish() > 0) {
+                                       this.mailsite_last_upload = 
System.currentTimeMillis();
+                               }
+                       }
+                       
                        if (this.nf != null) {
                                nf.fetch();
                        }

Modified: trunk/apps/Freemail/src/freemail/fcp/HighLevelFCPClient.java
===================================================================
--- trunk/apps/Freemail/src/freemail/fcp/HighLevelFCPClient.java        
2006-07-23 15:50:59 UTC (rev 9735)
+++ trunk/apps/Freemail/src/freemail/fcp/HighLevelFCPClient.java        
2006-07-23 17:27:55 UTC (rev 9736)
@@ -145,7 +145,7 @@
                                return -1;
                        }
                        if (emsg == null) {
-                               System.out.println("insert successful");
+                               System.out.println("insert of 
"+basekey+"-"+slot+suffix+" successful");
                                return slot;
                        } else if (emsg.errorcode == 
FCPInsertErrorMessage.COLLISION) {
                                slot++;
@@ -175,7 +175,7 @@
                                return -1;
                        }
                        if (emsg == null) {
-                               System.out.println("insert successful");
+                               System.out.println("insert of 
"+basekey+"-"+slot+suffix+" successful");
                                return slot;
                        } else if (emsg.errorcode == 
FCPInsertErrorMessage.COLLISION) {
                                slot++;


Reply via email to