Changeset ff8348650ab13cd736fb6ce92ca6e552d7b5c955
- Timestamp:
- 12/02/10 05:22:05 (2 years ago)
- Author:
- Nedko Arnaudov <nedko@…>
- Children:
- 68049ee6cb9d9109c9fb235345d54e500c384036
- Parents:
- b8852eaf9f2cba6aaa741a3baaef583c5efb755d
- git-author:
- Nedko Arnaudov <nedko@arnaudov.name> / 2010-12-02T05:21:51Z+0200
- git-committer:
- Nedko Arnaudov <nedko@arnaudov.name> / 2010-12-02T05:22:05Z+0200
- Message:
-
Move the dbus call default timeout define out of the interface header
The default timeout is a property of the implementation, not the interface
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r7a6f304
|
rff83486
|
|
| 39 | 39 | #include "../common/klist.h" |
| 40 | 40 | |
| | 41 | #define DBUS_CALL_DEFAULT_TIMEOUT 3000 // in milliseconds |
| | 42 | |
| 41 | 43 | DBusConnection * g_dbus_connection; |
| 42 | 44 | DBusError g_dbus_error; |
| … |
… |
|
| 331 | 333 | |
| 332 | 334 | return true; |
| | 335 | } |
| | 336 | |
| | 337 | DBusMessage * |
| | 338 | dbus_call_raw( |
| | 339 | unsigned int timeout, |
| | 340 | DBusMessage * request_ptr) |
| | 341 | { |
| | 342 | DBusMessage * reply_ptr; |
| | 343 | |
| | 344 | if (timeout == 0) |
| | 345 | { |
| | 346 | timeout = DBUS_CALL_DEFAULT_TIMEOUT; |
| | 347 | } |
| | 348 | |
| | 349 | reply_ptr = dbus_connection_send_with_reply_and_block( |
| | 350 | g_dbus_connection, |
| | 351 | request_ptr, |
| | 352 | timeout, |
| | 353 | &g_dbus_error); |
| | 354 | if (reply_ptr == NULL) |
| | 355 | { |
| | 356 | //log_error("calling method '%s' failed, error is '%s'", method, g_dbus_error.message); |
| | 357 | dbus_error_free(&g_dbus_error); |
| | 358 | } |
| | 359 | |
| | 360 | return reply_ptr; |
| 333 | 361 | } |
| 334 | 362 | |
| … |
… |
|
| 356 | 384 | //log_info("dbus_call('%s', '%s', '%s', '%s')", service, object, iface, method); |
| 357 | 385 | |
| 358 | | if (timeout == 0) |
| 359 | | { |
| 360 | | timeout = DBUS_CALL_DEFAULT_TIMEOUT; |
| 361 | | } |
| 362 | | |
| 363 | 386 | ret = false; |
| 364 | 387 | va_start(ap, input_signature); |
| … |
… |
|
| 411 | 434 | output_signature = va_arg(ap, const char *); |
| 412 | 435 | |
| 413 | | reply_ptr = dbus_connection_send_with_reply_and_block( |
| 414 | | g_dbus_connection, |
| 415 | | request_ptr, |
| 416 | | timeout, |
| 417 | | &g_dbus_error); |
| | 436 | reply_ptr = dbus_call_raw(timeout, request_ptr); |
| 418 | 437 | |
| 419 | 438 | if (input_signature != NULL) |
| … |
… |
|
| 424 | 443 | if (reply_ptr == NULL) |
| 425 | 444 | { |
| 426 | | //log_error("calling method '%s' failed, error is '%s'", method, g_dbus_error.message); |
| 427 | | dbus_error_free(&g_dbus_error); |
| 428 | 445 | goto fail; |
| 429 | 446 | } |
-
|
r7a6f304
|
rff83486
|
|
| 43 | 43 | bool dbus_add_dict_entry_uint32(DBusMessageIter * dict_iter_ptr, const char * key, dbus_uint32_t value); |
| 44 | 44 | bool dbus_add_dict_entry_bool(DBusMessageIter * dict_iter_ptr, const char * key, dbus_bool_t value); |
| | 45 | |
| | 46 | DBusMessage * |
| | 47 | dbus_call_raw( |
| | 48 | unsigned int timeout, /* in milliseconds */ |
| | 49 | DBusMessage * request_ptr); |
| 45 | 50 | |
| 46 | 51 | bool |
| … |
… |
|
| 107 | 112 | const char * service); |
| 108 | 113 | |
| 109 | | #define DBUS_CALL_DEFAULT_TIMEOUT 3000 // in milliseconds |
| 110 | | |
| 111 | 114 | #include "method.h" |
| 112 | 115 | #include "signal.h" |
-
|
rb8852ea
|
rff83486
|
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | | // send message and get a handle for a reply |
| 230 | | reply_ptr = dbus_connection_send_with_reply_and_block( |
| 231 | | g_dbus_connection, |
| 232 | | request_ptr, |
| 233 | | DBUS_CALL_DEFAULT_TIMEOUT, |
| 234 | | &g_dbus_error); |
| 235 | | |
| | 229 | reply_ptr = dbus_call_raw(0, request_ptr); |
| 236 | 230 | dbus_message_unref(request_ptr); |
| 237 | | |
| 238 | 231 | if (reply_ptr == NULL) |
| 239 | 232 | { |
| 240 | | log_error("no reply from JACK server, error is '%s'", g_dbus_error.message); |
| 241 | | dbus_error_free(&g_dbus_error); |
| 242 | 233 | return false; |
| 243 | 234 | } |
| … |
… |
|
| 359 | 350 | } |
| 360 | 351 | |
| 361 | | // send message and get a handle for a reply |
| 362 | | reply_ptr = dbus_connection_send_with_reply_and_block( |
| 363 | | g_dbus_connection, |
| 364 | | request_ptr, |
| 365 | | DBUS_CALL_DEFAULT_TIMEOUT, |
| 366 | | &g_dbus_error); |
| 367 | | |
| | 352 | reply_ptr = dbus_call_raw(0, request_ptr); |
| 368 | 353 | dbus_message_unref(request_ptr); |
| 369 | | |
| 370 | 354 | if (reply_ptr == NULL) |
| 371 | 355 | { |
| 372 | | log_error("no reply from JACK server, error is '%s'", g_dbus_error.message); |
| 373 | | dbus_error_free(&g_dbus_error); |
| 374 | 356 | return false; |
| 375 | 357 | } |
| … |
… |
|
| 477 | 459 | } |
| 478 | 460 | |
| 479 | | // send message and get a handle for a reply |
| 480 | | reply_ptr = dbus_connection_send_with_reply_and_block( |
| 481 | | g_dbus_connection, |
| 482 | | request_ptr, |
| 483 | | DBUS_CALL_DEFAULT_TIMEOUT, |
| 484 | | &g_dbus_error); |
| 485 | | |
| | 461 | reply_ptr = dbus_call_raw(0, request_ptr); |
| 486 | 462 | dbus_message_unref(request_ptr); |
| 487 | | |
| 488 | 463 | if (reply_ptr == NULL) |
| 489 | 464 | { |
| 490 | | log_error("no reply from JACK server, error is '%s'", g_dbus_error.message); |
| 491 | | dbus_error_free(&g_dbus_error); |
| 492 | 465 | return false; |
| 493 | 466 | } |
| … |
… |
|
| 530 | 503 | } |
| 531 | 504 | |
| 532 | | // send message and get a handle for a reply |
| 533 | | reply_ptr = dbus_connection_send_with_reply_and_block( |
| 534 | | g_dbus_connection, |
| 535 | | request_ptr, |
| 536 | | DBUS_CALL_DEFAULT_TIMEOUT, |
| 537 | | &g_dbus_error); |
| 538 | | |
| | 505 | reply_ptr = dbus_call_raw(0, request_ptr); |
| 539 | 506 | dbus_message_unref(request_ptr); |
| 540 | | |
| 541 | 507 | if (reply_ptr == NULL) |
| 542 | 508 | { |
| 543 | | log_error("no reply from JACK server, error is '%s'", g_dbus_error.message); |
| 544 | | dbus_error_free(&g_dbus_error); |
| 545 | 509 | return false; |
| 546 | 510 | } |