Enlightenment CVS committal

Author  : lordchaos
Project : e17
Module  : apps/efsd

Dir     : e17/apps/efsd/efsd


Modified Files:
        efsd_io.c libefsd.c 


Log Message:
Deserialize commands attached to reply events properly

===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/efsd/efsd/efsd_io.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -3 -r1.46 -r1.47
--- efsd_io.c   8 Aug 2005 03:37:26 -0000       1.46
+++ efsd_io.c   8 Aug 2005 05:04:09 -0000       1.47
@@ -859,7 +859,10 @@
   }
   
   ecore_list_append(el, ecore_ipc_message_new(2, 1, 0,0,0,&ee->type, 
sizeof(EfsdEventType)));
+
+  printf("Reply event data: %s\n", ee->efsd_reply_event.data);
   ecore_list_append(el, ecore_ipc_message_new(2, 2, 
0,0,0,ee->efsd_reply_event.data, strlen(ee->efsd_reply_event.data)));
+  ecore_list_append(el, ecore_ipc_message_new(2,100,0,0,0,NULL,0));
 
 
   return el;
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/efsd/efsd/libefsd.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -3 -r1.60 -r1.61
--- libefsd.c   8 Aug 2005 03:37:26 -0000       1.60
+++ libefsd.c   8 Aug 2005 05:04:10 -0000       1.61
@@ -102,7 +102,10 @@
 
 static void      libefsd_callbacks_init(void);
 
+#if HAVE_ECORE
 static Ecore_Hash* partial_command_hash = NULL;
+static Ecore_Hash* partial_event_hash = NULL;
+#endif
 
 
 /*Ecore Event callbacks*/
@@ -116,19 +119,21 @@
 
    if ((e = (Ecore_Ipc_Event_Server_Data *) event))
    {
+       EfsdCommand* ec;
+       EfsdEvent* event;
+       ecore_ipc_message* msg= malloc(sizeof(ecore_ipc_message));
+       msg->major =e->major;
+       msg->minor = e->minor;
+       msg->ref = e->ref;
+       msg->ref_to = e->ref_to;
+       msg->response =e->response;
+       msg->data = e->data;
+       msg->len = e->size;
+
 
         switch (e->major) {
                case 1: printf("It's a command..\n");
                        {
-                          EfsdCommand* ec;
-                          ecore_ipc_message* msg= 
malloc(sizeof(ecore_ipc_message));
-                          msg->major =e->major;
-                          msg->minor = e->minor;
-                          msg->ref = e->ref;
-                          msg->ref_to = e->ref_to;
-                          msg->response =e->response;
-                          msg->data = e->data;
-                          msg->len = e->size;
 
                          ec = ecore_hash_get(partial_command_hash, e->server);
                          if (!ec) {
@@ -146,25 +151,52 @@
                                /*main_thread_launch(ec, e->client);*/
                          }
 
-                         free(msg);
                        }
                        
                
                        break;
        
                 case 2:
-                        printf ("it's a reply!\n");
+                        printf ("it's an event!\n");
+
+                       event = ecore_hash_get(partial_event_hash, e->server);
+                       if (!event) {
+                               event = NEW(EfsdEvent);
+                               ecore_hash_set(partial_event_hash, e->server, 
event);
+                       }
 
        
                        switch(e->minor) {
+                               case 1: printf("An EFSD Event type..\n");
+                                       
+                                       memcpy(&event->type, e->data, 
sizeof(EfsdEventType));
+                                       break;  
                                case 2:
                                        printf ("It's a data section..\n");
                                        printf ("Data is: %s\n", e->data);
+
+                                       event->efsd_reply_event.data = 
malloc(sizeof(char)*e->size);
+                                       strncpy(event->efsd_reply_event.data, 
e->data, e->size);
+                                       break;
+                               case 100:
+
+                                       printf("Event complete, 
assembling...\n");
+                                       ec = 
ecore_hash_get(partial_command_hash, e->server);
+
+                                       if (ec) {
+                                               event->efsd_reply_event.command 
= *ec;
+                                                       
+                                       }
+
+                                       printf("Filename is (from ec): %s\n", 
event->efsd_reply_event.command.efsd_file_cmd.files[0]);
+                                       break;
+                                       
                        }
                        
                         break;
         }
 
+       free(msg);
 
    }
 
@@ -510,6 +542,9 @@
   if (!partial_command_hash) {
        partial_command_hash = ecore_hash_new(ecore_direct_hash, 
ecore_direct_compare);
   }
+  if (!partial_event_hash) {
+       partial_event_hash = ecore_hash_new(ecore_direct_hash, 
ecore_direct_compare);
+  }
   
   #else
   if ( (ec->fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0)




-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to