Changeset 5465:d5e7bc292531 in roaraudio
- Timestamp:
- 03/31/12 02:30:26 (11 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
include/libroar/basic.h
r5381 r5465 102 102 void * userdata); 103 103 104 int roar_set_connection_version(struct roar_connection * con, int version); 105 104 106 int roar_sync (struct roar_connection * con); 105 107 int roar_wait_msg (struct roar_connection * con, int16_t seq, int16_t seqmask); -
include/libroar/config.h
r5381 r5465 130 130 char * daemonimage; 131 131 int serverflags; 132 int protocolversion; 132 133 }; 133 134 -
libroar/basic.c
r5428 r5465 451 451 452 452 int roar_connect_none (struct roar_connection * con) { 453 struct roar_libroar_config * config = roar_libroar_get_config(); 454 453 455 if ( con == NULL ) { 454 456 roar_err_set(ROAR_ERROR_INVAL); … … 459 461 con->refc = 1; 460 462 con->flags = ROAR_CON_FLAGS_NONE; 461 con->version = 0;463 con->version = _ROAR_MESSAGE_VERSION; 462 464 con->cb_userdata = NULL; 463 465 con->cb = NULL; … … 470 472 471 473 // con->flags |= ROAR_CON_FLAGS_VIO; 474 475 if ( config->protocolversion != -1 ) 476 roar_set_connection_version(con, config->protocolversion); 472 477 473 478 roar_err_set(ROAR_ERROR_NONE); … … 616 621 void * userdata), 617 622 void * userdata) { 618 if ( con == NULL ) 619 return -1; 623 if ( con == NULL ) { 624 roar_err_set(ROAR_ERROR_FAULT); 625 return -1; 626 } 620 627 621 628 con->cb = cb; 622 629 con->cb_userdata = userdata; 630 631 return 0; 632 } 633 634 int roar_set_connection_version(struct roar_connection * con, int version) { 635 if ( con == NULL ) { 636 roar_err_set(ROAR_ERROR_FAULT); 637 return -1; 638 } 639 640 if ( version == -1 ) 641 version = _ROAR_MESSAGE_VERSION; 642 643 if ( version < 0 ) { 644 roar_err_set(ROAR_ERROR_INVAL); 645 return -1; 646 } 647 648 con->version = version; 649 650 if ( version == 2 ) { 651 con->flags |= ROAR_CON_FLAGS_SUPPORT_V2; 652 } 623 653 624 654 return 0; -
libroar/config.c
r5381 r5465 58 58 config.connect_internal = NULL; 59 59 config.daemonimage = NULL; 60 config.protocolversion = -1; // use default. 60 61 61 62 if ( home != NULL ) { … … 319 320 ROAR_WARN("roar_libroar_config_parse(*): Unknown serverflag: %s", v); 320 321 } 322 } else if ( !strcmp(k, "protocolversion") ) { 323 config->protocolversion = atoi(v); 321 324 } else { 322 325 ROAR_WARN("roar_libroar_config_parse(*): Unknown option: %s", k); -
libroar/proto.c
r5463 r5465 70 70 71 71 headerlen = _ROAR_MESS_BUF_LEN; 72 73 mes->version = _ROAR_MESSAGE_VERSION;74 72 75 73 buf[0] = mes->version; // first byte is always the version. … … 320 318 return -1; 321 319 320 if ( mes->version == _ROAR_MESSAGE_VERSION ) 321 mes->version = con->version; 322 322 323 return roar_vreq2(vio, mes, data, errorframe); 323 324 }
Note: See TracChangeset
for help on using the changeset viewer.