From: discomfitor Date: Wed, 29 Sep 2010 23:50:33 +0000 (+0000) Subject: update to set fd handler flags X-Git-Tag: accepted/2.0/20130306.224007~195^2~567 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=22060711614949c0e811ffad948a7365ab31d56e;p=profile%2Fivi%2Fecore.git update to set fd handler flags git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@52909 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/examples/ecore_fd_handler_example.c b/examples/ecore_fd_handler_example.c index 551b8d9..b67e04e 100644 --- a/examples/ecore_fd_handler_example.c +++ b/examples/ecore_fd_handler_example.c @@ -10,8 +10,10 @@ /* Ecore_Fd_Handler example * 2010 Mike Blumenkrantz + * compile with gcc $(pkgconfig --cflags --libs gnutls ecore) */ + #define print(...) fprintf(stderr, "line %i: ", __LINE__); fprintf(stderr, __VA_ARGS__); fprintf(stderr, "\n") static int done = 0; @@ -103,12 +105,17 @@ static Eina_Bool _process_data(gnutls_session_t client, Ecore_Fd_Handler *fd_handler) { static int ret, lastret; + static unsigned int count = 0; if (!done) { lastret = ret; - print("calling gnutls_handshake()"); ret = gnutls_handshake (client); + count++; + if (gnutls_record_get_direction(client)) + ecore_main_fd_handler_active_set(fd_handler, ECORE_FD_WRITE); + else + ecore_main_fd_handler_active_set(fd_handler, ECORE_FD_READ); /* avoid printing messages infinity times */ if (lastret != ret) { @@ -129,7 +136,7 @@ _process_data(gnutls_session_t client, Ecore_Fd_Handler *fd_handler) if (ret == GNUTLS_E_SUCCESS) { done = 1; - print("Handshake successful!"); + print("Handshake successful in %u handshake calls!", count); ecore_main_loop_quit(); }