cURL / Mailing Lists / curl-library / Single Mail

curl-library

[hiper] hipev.c ++ ;-)

From: Alexander Lazic <al-curllibrary_at_none.at>
Date: Tue, 22 Aug 2006 20:54:40 +0200

Hi,

today i have worked further to hiper-tests based on hipev.c ;-)

I have changed also the two lines as Jeff Pohlmeyer pointed out ;-)

The eventcallback wouldn't be called if the server can answer the
request in one call of multi-perform.

Due this fact the libevent don't get an update of his timeout and we get
a libevent timeout, the test looks incomplete or faild although it is
all ok ;-)

I have make the 'CURLM *multi_handle;' global, and update the timer now
in also the writecallback now.

On a good run the timer will be set correctly, as you can see in 'good
run' output.

On a bad run, this i rather the *good* one ;-), the server answer so
fast that the init && run phase is accomplished before the main have a
chance to init the timer.

I have added a:

---
main()
.
.
struct timeval timeout;
.
.
.
  init_timeout.tv_sec = 5;
  init_timeout.tv_usec = RUN_FOR_THIS_LONG;
  
  evtimer_add(&timerevent, &init_timeout);
---
but this change not the behaviour  :-(
Have you some ideas how we can fix this behaviour!?
You can get the current code from:
http://none.at/alhipev.c
As we have seen none of the libevent/multi_sock callback is called only
easy callbacks.
Thanks for help ;-)
regards
Alex
--- good run
./alhipev 3 3 
About to do 6 connections
==> socket_callback() socket 6 easy 0x80844c0 what IN
==> socket_callback() Add info for socket 6 READ
<<<setsock() event_add() for fd 6 with action 1
==> socket_callback() socket 7 easy 0x807bf10 what IN
==> socket_callback() Add info for socket 7 READ
<<<setsock() event_add() for fd 7 with action 1
==> socket_callback() socket 8 easy 0x8073960 what IN
==> socket_callback() Add info for socket 8 READ
<<<setsock() event_add() for fd 8 with action 1
==> socket_callback() socket 9 easy 0x806b3c8 what IN
==> socket_callback() Add info for socket 9 READ
<<<setsock() event_add() for fd 9 with action 1
==> socket_callback() socket 10 easy 0x8062e30 what IN
==> socket_callback() Add info for socket 10 READ
<<<setsock() event_add() for fd 10 with action 1
==> socket_callback() socket 11 easy 0x805a898 what IN
==> socket_callback() Add info for socket 11 READ
<<<setsock() event_add() for fd 11 with action 1
update_timeout() call in main 
update_timeout() cur tv_sec :299:
update_timeout() cur tv_usec :551000:
update_timeout() timeout updated
EVENT callback type READ
writecallback() 00: 512, total 512
update_timeout() cur tv_sec :299:
update_timeout() cur tv_usec :537000:
update_timeout() timeout updated
==> socket_callback() socket 11 easy 0x805a898 what REMOVE
running_handles: 5
update_timeout() cur tv_sec :299:
update_timeout() cur tv_usec :537000:
update_timeout() timeout updated
EVENT callback type READ
writecallback() 01: 512, total 1024
update_timeout() cur tv_sec :299:
update_timeout() cur tv_usec :537000:
update_timeout() timeout updated
==> socket_callback() socket 10 easy 0x8062e30 what REMOVE
running_handles: 4
update_timeout() cur tv_sec :299:
update_timeout() cur tv_usec :537000:
update_timeout() timeout updated
EVENT callback type READ
writecallback() 02: 512, total 1536
update_timeout() cur tv_sec :299:
update_timeout() cur tv_usec :537000:
update_timeout() timeout updated
==> socket_callback() socket 9 easy 0x806b3c8 what REMOVE
running_handles: 3
update_timeout() cur tv_sec :299:
update_timeout() cur tv_usec :537000:
update_timeout() timeout updated
EVENT callback type READ
writecallback() 03: 512, total 2048
update_timeout() cur tv_sec :299:
update_timeout() cur tv_usec :537000:
update_timeout() timeout updated
==> socket_callback() socket 8 easy 0x8073960 what REMOVE
running_handles: 2
update_timeout() cur tv_sec :299:
update_timeout() cur tv_usec :537000:
update_timeout() timeout updated
EVENT callback type READ
writecallback() 04: 512, total 2560
update_timeout() cur tv_sec :299:
update_timeout() cur tv_usec :537000:
update_timeout() timeout updated
==> socket_callback() socket 7 easy 0x807bf10 what REMOVE
running_handles: 1
update_timeout() cur tv_sec :299:
update_timeout() cur tv_usec :537000:
update_timeout() timeout updated
EVENT callback type READ
writecallback() 05: 512, total 3072
update_timeout() cur tv_sec :299:
update_timeout() cur tv_usec :536000:
update_timeout() timeout updated
==> socket_callback() socket 6 easy 0x80844c0 what REMOVE
running_handles: 0
last transfer done, kill timeout
---
--- bad run
./alhipev 3 3 
About to do 6 connections
==> socket_callback() socket 6 easy 0x80844c0 what IN
==> socket_callback() Add info for socket 6 READ
<<<setsock() event_add() for fd 6 with action 1
==> socket_callback() socket 7 easy 0x807bf10 what IN
==> socket_callback() Add info for socket 7 READ
<<<setsock() event_add() for fd 7 with action 1
==> socket_callback() socket 8 easy 0x8073960 what IN
==> socket_callback() Add info for socket 8 READ
<<<setsock() event_add() for fd 8 with action 1
==> socket_callback() socket 9 easy 0x806b3c8 what IN
==> socket_callback() Add info for socket 9 READ
<<<setsock() event_add() for fd 9 with action 1
==> socket_callback() socket 10 easy 0x8062e30 what IN
==> socket_callback() Add info for socket 10 READ
<<<setsock() event_add() for fd 10 with action 1
==> socket_callback() socket 11 easy 0x805a898 what IN
==> socket_callback() Add info for socket 11 READ
<<<setsock() event_add() for fd 11 with action 1
writecallback() 05: 512, total 512
update_timeout() cur tv_sec :299:
update_timeout() cur tv_usec :303000:
update_timeout() timeout updated
writecallback() 04: 512, total 1024
update_timeout() cur tv_sec :299:
update_timeout() cur tv_usec :302000:
update_timeout() timeout updated
writecallback() 03: 512, total 1536
update_timeout() cur tv_sec :299:
update_timeout() cur tv_usec :302000:
update_timeout() timeout updated
writecallback() 02: 512, total 2048
update_timeout() cur tv_sec :299:
update_timeout() cur tv_usec :301000:
update_timeout() timeout updated
writecallback() 01: 512, total 2560
update_timeout() cur tv_sec :299:
update_timeout() cur tv_usec :301000:
update_timeout() timeout updated
writecallback() 00: 512, total 3072
update_timeout() cur tv_sec :299:
update_timeout() cur tv_usec :300000:
update_timeout() timeout updated
==> socket_callback() socket 6 easy 0x80844c0 what REMOVE
==> socket_callback() socket 7 easy 0x807bf10 what REMOVE
==> socket_callback() socket 8 easy 0x8073960 what REMOVE
==> socket_callback() socket 9 easy 0x806b3c8 what REMOVE
==> socket_callback() socket 10 easy 0x8062e30 what REMOVE
==> socket_callback() socket 11 easy 0x805a898 what REMOVE
update_timeout() call in main
update_timeout() cur tv_sec :0:
update_timeout() cur tv_usec :4294966296:
update_timeout() timeout updated
EVENT timeout
---
Received on 2006-08-22