Validate socket FD & optimize recv context. 28/18428/1 accepted/tizen_ivi_panda tizen_3.0.m14.2_ivi tizen_ivi_panda accepted/tizen/common/20140506.092610 accepted/tizen/ivi/20140430.194310 accepted/tizen/ivi/panda/20140403.015123 accepted/tizen/mobile/20140702.100351 submit/tizen/20140430.015826 submit/tizen_ivi_panda/20140403.011837 tizen_3.0.m14.2_ivi_release
authorSung-jae Park <nicesj.park@samsung.com>
Mon, 24 Mar 2014 00:35:39 +0000 (09:35 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Mon, 24 Mar 2014 00:35:39 +0000 (09:35 +0900)
commita83dbae72a28c263abb7bf5374a1b41290eca00d
treef0d079da2beca953f7f3ec998f06670958708af7
parent9fcb4fbefd3692587d6623adb6504e257fc77ba8
Validate socket FD & optimize recv context.

From the recv ctx callback, the socket can be closed.
But the glib cannot detect the closed FD correctly.
(It doesn't toggles G_IO_HUP, G_IO_ERR, G_IO_NVAL bits even though I closed the FD)
So I checked the FD from the callback explicitly, before return from it.
However this patch will be available only for the Single-Thread loop. (com-core)

And the receive context is optimized.
Every single loop after done to prepare A receive context,
it will be destroyed. But this patch will reuse it instead of destroying it.
So there is no need to reallocate same memory again.
It will save few milli (or micro) seconds.

for the future-work.
I'll optimize the "packet" creating code.
It can be reused too after finish the processing of receive context.
Then we can save more few milli(micro) seconds (for reallocating time).

Each execution takes small time.
But this scenario occupies almost time for communicating with other processes.
it means, even though it can save few milli(micro) secs for each time.
The total saved time will be meaningful.

Change-Id: Ibb3adc715090b6d78a5cfeb48d28463f35b9a0f4
packaging/libcom-core.spec
src/com-core.c
src/com-core_packet.c