summaryrefslogtreecommitdiff
path: root/src/lib/ecore_ipc
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>2016-11-23 00:01:14 -0200
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>2016-11-23 00:01:14 -0200
commite6939ebc90187eb00660f2f3632fa007fa1baa49 (patch)
tree1c646761a665bec8110ba380b9c498b9ee65a97e /src/lib/ecore_ipc
parent520b57e974192dce8ad9ef130ca87c4a9525cddb (diff)
ecore_ipc: refactor client data processing in its own function.
When we move to efl_net we'll reuse the same function to process incoming data, thus refactor the code in their own function so it can be reused.
Diffstat (limited to 'src/lib/ecore_ipc')
-rw-r--r--src/lib/ecore_ipc/ecore_ipc.c48
1 files changed, 35 insertions, 13 deletions
diff --git a/src/lib/ecore_ipc/ecore_ipc.c b/src/lib/ecore_ipc/ecore_ipc.c
index 296d61430d..d999d585d8 100644
--- a/src/lib/ecore_ipc/ecore_ipc.c
+++ b/src/lib/ecore_ipc/ecore_ipc.c
@@ -975,28 +975,23 @@ _ecore_ipc_event_server_del(void *data EINA_UNUSED, int ev_type EINA_UNUSED, voi
975 msg._member = _ecore_ipc_ddlt_int(d, cl->prev.i._member, md); 975 msg._member = _ecore_ipc_ddlt_int(d, cl->prev.i._member, md);
976 976
977static Eina_Bool 977static Eina_Bool
978_ecore_ipc_event_client_data(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *ev) 978ecore_ipc_client_data_process(Ecore_Ipc_Client *cl, void *data, int size, Eina_Bool *stolen)
979{ 979{
980 Ecore_Con_Event_Client_Data *e; 980 /* use e->data and e->size to reduce diff to original code */
981 Ecore_Ipc_Server *svr; 981 struct { void *data; int size; } _e = { data, size }, *e = &_e;
982 982 Ecore_Ipc_Server *svr = ecore_ipc_client_server_get(cl);
983 e = ev; 983 *stolen = EINA_FALSE;
984 svr = ecore_con_server_data_get(ecore_con_client_server_get(e->client)); 984 if (1)
985 if (!eina_list_data_find(servers, svr)) return ECORE_CALLBACK_RENEW; 985 { /* keep same identation as original code to help verification */
986 /* handling code here */
987 {
988 Ecore_Ipc_Client *cl;
989 Ecore_Ipc_Msg_Head msg; 986 Ecore_Ipc_Msg_Head msg;
990 int offset = 0; 987 int offset = 0;
991 unsigned char *buf; 988 unsigned char *buf;
992 989
993 cl = ecore_con_client_data_get(e->client);
994
995 if (!cl->buf) 990 if (!cl->buf)
996 { 991 {
997 cl->buf_size = e->size; 992 cl->buf_size = e->size;
998 cl->buf = e->data; 993 cl->buf = e->data;
999 e->data = NULL; /* take it out of the old event */ 994 *stolen = EINA_TRUE;
1000 } 995 }
1001 else 996 else
1002 { 997 {
@@ -1126,6 +1121,33 @@ _ecore_ipc_event_client_data(void *data EINA_UNUSED, int ev_type EINA_UNUSED, vo
1126 cl->buf_size -= offset; 1121 cl->buf_size -= offset;
1127 } 1122 }
1128 } 1123 }
1124
1125 return ECORE_CALLBACK_CANCEL;
1126}
1127
1128static Eina_Bool
1129_ecore_ipc_event_client_data(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *ev)
1130{
1131 Ecore_Con_Event_Client_Data *e;
1132 Ecore_Ipc_Server *svr;
1133
1134 e = ev;
1135 svr = ecore_con_server_data_get(ecore_con_client_server_get(e->client));
1136 if (!eina_list_data_find(servers, svr)) return ECORE_CALLBACK_RENEW;
1137 /* handling code here */
1138 {
1139 Ecore_Ipc_Client *cl;
1140 Eina_Bool stolen;
1141
1142 cl = ecore_con_client_data_get(e->client);
1143
1144 ecore_ipc_client_data_process(cl, e->data, e->size, &stolen);
1145 if (stolen)
1146 {
1147 e->data = NULL;
1148 e->size = 0;
1149 }
1150 }
1129 return ECORE_CALLBACK_CANCEL; 1151 return ECORE_CALLBACK_CANCEL;
1130} 1152}
1131 1153