Bug fixed for native read errors , new errors in native write
authoradash <adash>
Wed, 8 Nov 2006 02:38:26 +0000 (02:38 +0000)
committeradash <adash>
Wed, 8 Nov 2006 02:38:26 +0000 (02:38 +0000)
TO Do fix it

Robust/src/Tests/WebServerExample.java
Robust/src/Tests/WebServerSocket.java

index ee714e4e9b5d1ca85961006cdad0967105f876c0..09ed26d11c06ae0e5abce378ebe72c11a7fcfe1e 100644 (file)
@@ -14,21 +14,22 @@ task Startup(StartupObject s {initialstate}) {
 //Listen for a request and accept request 
 task AcceptConnection(ServerSocket ss{SocketPending}) {
        System.printString("W> Waiting for connection...\n");
-       WebServerSocket web = new WebServerSocket() {!WritePending, !TransPending};
+       WebServerSocket web = new WebServerSocket() {!WritePending, !TransPending, WebInitialize};
        ss.accept(web);
        System.printString("W> Connected... \n");
 }
 
 // Process the incoming http request 
-task ProcessRequest(WebServerSocket web{IOPending}) {
+task ProcessRequest(WebServerSocket web{IOPending && WebInitialize}) {
+//task ProcessRequest(WebServerSocket web{IOPending}) {
        System.printString("W> Inside ProcessRequest... \n");
        web.clientrequest();
        if(web.checktrans()==false)
                // Not special transaction , do normal filesending      
-               taskexit(web {WritePending, LogPending}); //Sets the WritePending and LogPending flag true 
+               taskexit(web {WritePending, LogPending,!WebInitialize}); //Sets the WritePending and LogPending flag true 
        else 
                // Invoke special inventory transaction
-               taskexit(web {TransPending, LogPending});
+               taskexit(web {TransPending, LogPending,!WebInitialize});
 }
 
 //Do the WriteIO on server socket and send the requested file to Client
@@ -104,7 +105,7 @@ task Transaction(WebServerSocket web{TransPending}, Inventory inventorylist{Tran
        } else { /* Error */ 
                System.printString("T > Error - Unknown transaction\n");
        }
-       //Invoke operations
+       //Invoke close operations
        web.close();
        taskexit(web {!TransPending});
 }
index b8abe511f70bb74699dd48b9b5bd23ac8efe4b97..330764f69332297647fab6d297152a7dfd6d6001 100644 (file)
@@ -3,6 +3,8 @@ public class WebServerSocket extends Socket {
        flag LogPending;
        flag WritePending;
        flag TransPending;
+       flag WebInitialize;
+       
        //Filename requested by the client 
        String filename;
        String[] parsed; 
@@ -61,12 +63,9 @@ public class WebServerSocket extends Socket {
                byte b1[] = new byte[1024];
                read(b1);//Read client request from web server socket
                String clientreq = new String(b1);
-               //System.printString(clientreq);
-               //System.printString("\n");
                int index = clientreq.indexOf('/');//Parse the GET client request to find filename
                int end = clientreq.indexOf('H');
                filename = clientreq.subString((index+1), (end-1));
-               //System.printString(filename);
                System.printString("\n");
                return 0;
        }
@@ -81,7 +80,10 @@ public class WebServerSocket extends Socket {
                }
        }
 
-       
+       //Parse for the substrings in the filename and use it to obtain the
+       //kind of operation, name of item, quantity of item, price of item
+       //e.g. trans_add_car_2_10000 is the filename
+       //store in the parsed[] string , add,car,2,1000
        public int parseTransaction(){
                int start = filename.indexOf('_');
                String s = filename.subString(start+1);