protocoldetector: Fix polling timeout

The event loop was calculating timeout in seconds, but poll timeout
should be milliseconds. This caused poll to wait up to 30 milliseconds
instead of 30 seconds where there are no events to handle.

Profiling a system running one vm for 5 mintues show _process_events is
dominating the profile, taking 55% of cpu time:

    Mon Nov 17 00:22:02 2014    vdsmd-master.prof

         14440725 function calls (14721061 primitive calls) in 16.907 CPU seconds

    Ordered by: internal time
    List reduced from 3079 to 10 due to restriction <10>

    ncalls  tottime  percall  cumtime  percall filename:lineno(function)
 2241981    5.685    0.000    9.445    0.000 protocoldetector.py:108(MultiProtocolAcceptor._process_events)
 4501127    1.442    0.000    1.442    0.000 time:0(time)
 2246162    1.396    0.000    1.396    0.000 __builtin__:0(poll)
 2242305    0.737    0.000    0.737    0.000 __builtin__:0(max)
    6566    0.352    0.000    0.536    0.000 spark.py:211(Parser.buildState)
   50705    0.170    0.001    0.373    0.000 copy.py:144(deepcopy)
     127    0.158    0.001    0.158    0.001 cpopen.cpopen:0(createProcess)
   10394    0.154    0.000    0.154    0.000 __builtin__:0(open)
  154006    0.132    0.000    0.269    0.000 encoder.py:284(JSONEncoder._iterencode)
    2533    0.124    0.000    0.141    0.000 pthread.py:133(Cond.timedwait)

With this patch we can see that number of functions calls decreased by 76% and
total cpu time decreased by 57%:

    Mon Nov 17 00:33:44 2014    vdsmd-poll-timeout.prof

         3344648 function calls (3624721 primitive calls) in 7.340 CPU seconds

    Ordered by: internal time
    List reduced from 3069 to 10 due to restriction <10>

    ncalls  tottime  percall  cumtime  percall filename:lineno(function)
      6435    0.346    0.000    0.518    0.000 spark.py:211(Parser.buildState)
       122    0.166    0.001    0.166    0.001 cpopen.cpopen:0(createProcess)
     10202    0.157    0.000    0.157    0.000 __builtin__:0(open)
     50705    0.148    0.001    0.329    0.000 copy.py:144(deepcopy)
        98    0.140    0.001    0.140    0.001 posix:0(fork)
    154178    0.115    0.000    0.236    0.000 encoder.py:284(JSONEncoder._iterencode)
      2496    0.113    0.000    0.131    0.000 pthread.py:133(Cond.timedwait)
      5870    0.112    0.000    0.153    0.000 spark.py:103(Parser.addRule)
      3325    0.109    0.000    0.194    0.000 __init__.py:226(LogRecord.__init__)
     28264    0.103    0.000    0.384    0.000 protocoldetector.py:108(MultiProtocolAcceptor._process_events)

Now we calculate the the timeout correctly, and improved variable names
make this code unlikely to break again.

Change-Id: If676b543bff30d08067d2cff3e0639c7e415f61f
Bug-Url: https://bugzilla.redhat.com/1177533
Signed-off-by: Nir Soffer <nsoffer@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/35212
Reviewed-by: Francesco Romani <fromani@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-by: Piotr Kliczewski <piotr.kliczewski@gmail.com>
Reviewed-by: Saggi Mizrahi <smizrahi@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/36409
Reviewed-by: Yaniv Bronhaim <ybronhei@redhat.com>