Changeset 1337:133222591226 in roaraudio for libroar/vio_dstr.c


Ignore:
Timestamp:
03/23/09 14:26:01 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

support sockets with no dst to use defaults from parent object

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroar/vio_dstr.c

    r1335 r1337  
    430430     next->def->d.fh = tmp[1]; 
    431431    break; 
     432#ifdef ROAR_HAVE_UNIX 
    432433   case ROAR_VIO_DSTR_OBJT_UNIX: 
    433434     c->need_vio = 0; 
    434435     next->def = &(next->store_def); 
    435436 
    436      if ( c->def != NULL ) { 
    437       roar_vio_dstr_init_defaults(next->def, ROAR_VIO_DEF_TYPE_SOCKET, c->def->o_flags, c->def->o_mode); 
    438      } else { 
    439       roar_vio_dstr_init_defaults(next->def, ROAR_VIO_DEF_TYPE_SOCKET, O_WRONLY, 0644); 
     437     if ( c->dst == NULL ) { // we don't have a destination? -> slow way 
     438      if ( roar_vio_socket_init_dstr_def(next->def, c->dst, AF_UNIX, SOCK_STREAM, c->def) == -1 ) 
     439       return -1; 
     440     } else {                // we have a destination? -> fast way 
     441      if ( c->def != NULL ) { 
     442       roar_vio_dstr_init_defaults(next->def, ROAR_VIO_DEF_TYPE_SOCKET, c->def->o_flags, c->def->o_mode); 
     443      } else { 
     444       roar_vio_dstr_init_defaults(next->def, ROAR_VIO_DEF_TYPE_SOCKET, O_WRONLY, 0644); 
     445      } 
     446 
     447      if ( roar_vio_socket_init_unix_def(next->def, c->dst) == -1 ) 
     448       return -1; 
    440449     } 
    441  
    442      if ( roar_vio_socket_init_unix_def(next->def, c->dst) == -1 ) 
    443       return -1; 
    444     break; 
     450    break; 
     451#endif 
    445452   case ROAR_VIO_DSTR_OBJT_SOCKET: 
    446453     c->need_vio = 0; 
     
    532539  } 
    533540 
     541  if ( roar_vio_init_calls(tc) == -1 ) { 
     542   free(tc); 
     543   _ret(-1); 
     544  } 
     545 
    534546  if ( roar_vio_stack_add(calls, tc) == -1 ) { 
    535547   _ret(-1); 
     
    548560  if ( c->need_vio ) { 
    549561   if ( (tc = malloc(sizeof(struct roar_vio_calls))) == NULL ) { 
     562    _ret(-1); 
     563   } 
     564 
     565   if ( roar_vio_init_calls(tc) == -1 ) { 
     566    free(tc); 
    550567    _ret(-1); 
    551568   } 
Note: See TracChangeset for help on using the changeset viewer.