Commit 2938cc60892033b6355412180f64fba843a0bea1
1 parent
856f6f8f
Exists in
master
and in
3 other branches
Decreasing delay in "wait_for_ready" method.
Showing
3 changed files
with
11 additions
and
10 deletions
Show diff stats
src/core/iocalls.c
| ... | ... | @@ -479,24 +479,23 @@ LIB3270_EXPORT int lib3270_wait_for_update(H3270 *hSession, int seconds) |
| 479 | 479 | |
| 480 | 480 | LIB3270_EXPORT int lib3270_wait_for_ready(H3270 *hSession, int seconds) |
| 481 | 481 | { |
| 482 | - time_t end = time(0)+seconds; | |
| 482 | + time_t end = time(0)+seconds; | |
| 483 | 483 | |
| 484 | - event_dispatcher(hSession,0); | |
| 485 | - | |
| 486 | - if(!lib3270_lock_status(hSession)) | |
| 487 | - return 0; | |
| 484 | + FAIL_IF_NOT_ONLINE(hSession); | |
| 488 | 485 | |
| 489 | - while(time(0) < end) | |
| 486 | + event_dispatcher(hSession,0); | |
| 487 | + do | |
| 490 | 488 | { |
| 491 | - event_dispatcher(hSession,1); | |
| 492 | - | |
| 493 | 489 | if(!lib3270_lock_status(hSession)) |
| 494 | 490 | return 0; |
| 495 | 491 | |
| 496 | 492 | if(!lib3270_connected(hSession)) |
| 497 | 493 | return ENOTCONN; |
| 498 | 494 | |
| 495 | + event_dispatcher(hSession,1); | |
| 496 | + | |
| 499 | 497 | } |
| 498 | + while(time(0) < end); | |
| 500 | 499 | |
| 501 | 500 | return ETIMEDOUT; |
| 502 | 501 | } | ... | ... |
src/core/linux/event_dispatcher.c
src/testprogram/testprogram.c
| ... | ... | @@ -88,7 +88,9 @@ int main(int argc, char *argv[]) |
| 88 | 88 | |
| 89 | 89 | if(!rc) |
| 90 | 90 | { |
| 91 | + printf("\n\nWaiting starts %u\n",(unsigned int) time(NULL)); | |
| 91 | 92 | lib3270_wait_for_ready(h,10); |
| 93 | + printf("Waiting ends %u\n\n",(unsigned int) time(NULL)); | |
| 92 | 94 | |
| 93 | 95 | lib3270_autoptr(char) text = lib3270_get_string_at_address(h,0,-1,0); |
| 94 | 96 | if(text) | ... | ... |