Changeset 3869:c63e1367041c in roaraudio for libroar/basic.c
- Timestamp:
- 05/19/10 22:14:22 (14 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroar/basic.c
r3836 r3869 231 231 memset(con, 0, sizeof(struct roar_connection)); 232 232 233 con->__fh = fh; 233 con->flags = ROAR_CON_FLAGS_FH; 234 con->__fh = fh; 235 236 if ( roar_vio_open_fh_socket(&(con->viocon), fh) != -1 ) 237 con->flags |= ROAR_CON_FLAGS_VIO; 234 238 235 239 roar_errno = ROAR_ERROR_NONE; … … 238 242 239 243 int roar_get_connection_fh (struct roar_connection * con) { 240 roar_debug_warn_sysio("roar_get_connection_fh", "roar_get_connection_vio ", NULL);244 roar_debug_warn_sysio("roar_get_connection_fh", "roar_get_connection_vio2", NULL); 241 245 242 246 if ( con == NULL ) 243 247 return -1; 244 248 249 if ( !(con->flags & ROAR_CON_FLAGS_FH) ) 250 return -1; 251 245 252 return con->__fh; 246 253 } 247 254 248 255 int roar_get_connection_vio (struct roar_connection * con, struct roar_vio_calls * vio) { 256 roar_debug_warn_obsolete("roar_get_connection_vio", "roar_get_connection_vio2", NULL); 257 249 258 if ( con == NULL || vio == NULL ) 250 259 return -1; 251 260 261 if ( !(con->flags & ROAR_CON_FLAGS_FH) ) 262 return -1; 263 252 264 return roar_vio_open_fh_socket(vio, con->__fh); 253 265 } 254 266 267 struct roar_vio_calls * roar_get_connection_vio2 (struct roar_connection * con) { 268 if ( con == NULL ) 269 return NULL; 270 271 if ( con->flags & ROAR_CON_FLAGS_VIO ) 272 return &(con->viocon); 273 274 // TODO: try to open the VIO. 275 276 return NULL; 277 } 278 255 279 int roar_disconnect (struct roar_connection * con) { 256 struct roar_vio_calls vio;280 struct roar_vio_calls * vio; 257 281 struct roar_message m; 258 282 … … 264 288 roar_req(con, &m, NULL); 265 289 266 if ( roar_get_connection_vio(con, &vio) != -1) {267 roar_vio_close( &vio);290 if ( (vio = roar_get_connection_vio2(con)) != NULL ) { 291 roar_vio_close(vio); 268 292 } 269 293 … … 329 353 #define _ROAR_MESS_BUF_LEN (1 /* version */ + 1 /* cmd */ + 2 /* stream */ + 4 /* pos */ + 2 /* datalen */) 330 354 int roar_send_message (struct roar_connection * con, struct roar_message * mes, char * data) { 331 struct roar_vio_calls vio;332 333 if ( roar_get_connection_vio(con, &vio) == -1)334 return -1; 335 336 return roar_vsend_message( &vio, mes, data);355 struct roar_vio_calls * vio; 356 357 if ( (vio = roar_get_connection_vio2(con)) == NULL ) 358 return -1; 359 360 return roar_vsend_message(vio, mes, data); 337 361 } 338 362 … … 369 393 370 394 int roar_recv_message (struct roar_connection * con, struct roar_message * mes, char ** data) { 371 struct roar_vio_calls vio;372 373 if ( roar_get_connection_vio(con, &vio) == -1)374 return -1; 375 376 return roar_vrecv_message( &vio, mes, data);395 struct roar_vio_calls * vio; 396 397 if ( (vio = roar_get_connection_vio2(con)) == NULL ) 398 return -1; 399 400 return roar_vrecv_message(vio, mes, data); 377 401 } 378 402 … … 464 488 465 489 int roar_req (struct roar_connection * con, struct roar_message * mes, char ** data) { 466 struct roar_vio_calls vio;467 468 if ( roar_get_connection_vio(con, &vio) == -1)469 return -1; 470 471 return roar_vreq( &vio, mes, data);490 struct roar_vio_calls * vio; 491 492 if ( (vio = roar_get_connection_vio2(con)) == NULL ) 493 return -1; 494 495 return roar_vreq(vio, mes, data); 472 496 } 473 497
Note: See TracChangeset
for help on using the changeset viewer.