Changeset 5163:22c49b4be8cd in roaraudio
- Timestamp:
- 10/16/11 23:58:09 (12 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroar/simple.c
r5148 r5163 292 292 } 293 293 294 if ( select((confh > listen ? confh : listen) + 1, &fds, &fds, &fds, &timeout) < 1 ) {294 if ( select((confh > listen ? confh : listen) + 1, &fds, NULL, NULL, &timeout) < 1 ) { 295 295 close(listen); 296 296 … … 309 309 /* errr, do we need we any error handling here? */ 310 310 } 311 312 if ( roar_recv_message(con, &mes, NULL) == -1 ) { 313 if ( fh != -1 ) 314 close(fh); 315 fh = -1; 316 } else if ( mes.cmd != ROAR_CMD_OK ) { 317 if ( fh != -1 ) 318 close(fh); 319 fh = -1; 320 } 311 321 } else { 312 322 // we don't need to check the content as we know it failed... 313 if ( roar_recv_message(con, &mes, NULL) == -1 ) 323 if ( roar_recv_message(con, &mes, NULL) == -1 ) { 324 close(listen); 314 325 return -1; 315 316 if ( roar_kick(con, ROAR_OT_STREAM, s->id) == -1 ) 317 return -1; 318 319 return roar_simple_new_stream_attachexeced_obj(con, s, rate, channels, bits, codec, dir); 320 } 321 if ( roar_recv_message(con, &mes, NULL) == -1 ) { 322 close(fh); 323 fh = -1; 324 } else if ( mes.cmd != ROAR_CMD_OK ) { 325 close(fh); 326 fh = -1; 326 } 327 328 if ( mes.cmd != ROAR_CMD_OK ) { 329 close(listen); 330 if ( roar_kick(con, ROAR_OT_STREAM, s->id) == -1 ) 331 return -1; 332 333 return roar_simple_new_stream_attachexeced_obj(con, s, rate, channels, bits, codec, dir); 334 } else { // seems like we have a positive reply. So we retry the listen socket: 335 FD_ZERO(&fds); 336 FD_SET(listen, &fds); 337 timeout.tv_sec = 0; 338 timeout.tv_usec = 128000L; 339 fh = -1; 340 if ( select(listen + 1, &fds, NULL, NULL, &timeout) > 0 ) { 341 if ( (fh = accept(listen, NULL, NULL)) == -1 ) { 342 close(listen); 343 if ( roar_kick(con, ROAR_OT_STREAM, s->id) == -1 ) 344 return -1; 345 346 return roar_simple_new_stream_attachexeced_obj(con, s, rate, channels, bits, codec, dir); 347 } 348 } 349 } 327 350 } 328 351 }
Note: See TracChangeset
for help on using the changeset viewer.