Events: protection from stale events in eventport and devpoll.

Stale write event may happen if read and write events was reported both,
and processing of the read event closed descriptor.

In practice this might result in "sendfilev() failed (134: ..." or
"writev() failed (134: ..." errors when switching to next upstream server.

See report here:
http://mailman.nginx.org/pipermail/nginx/2013-April/038421.html


git-svn-id: svn://svn.nginx.org/nginx/trunk@5171 73f98a42-aea0-e011-b76d-00259023448c
Events: handle only active events in eventport.

We generate both read and write events if an error event was returned by
port_getn() without POLLIN/POLLOUT, but we should not try to handle inactive
events, they may even have no handler.


git-svn-id: svn://svn.nginx.org/nginx/trunk@5172 73f98a42-aea0-e011-b76d-00259023448c