Changeset 5376:c8f94c6ad2a3 in roaraudio


Ignore:
Timestamp:
12/23/11 02:32:21 (12 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

finished rewrite of socket.[ch] for this release. Closes: #187

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r5367 r5376  
    44        * Do not set errno to zero in ogg_vorbis codec filter (Closes: #191) 
    55        * Updated data types for struct roar_audio_info (Closes: #189) 
    6         * Removed old functions from API (Closes: #186, See: #130) 
     6        * Removed old functions from API (Closes: #186, #187, See: #130) 
    77        * Removed old roarclients (See: #130) 
    88        * Improved plugin loader a lot (Closes: #190) 
  • include/libroar/socket.h

    r5375 r5376  
    6363int roar_socket_open       (int mode, int type, const char * host, int port); 
    6464 
    65 int roar_socket_listen_decnet (const char * object, int num); 
    66  
    6765const char * roar_socket_get_local_nodename(void); 
    6866 
    6967int roar_socket_nonblock(int fh, int state); 
    70 int roar_socket_decnet_set_timeout (int fh, time_t sec, int_least32_t usec); 
    7168 
    7269int roar_socket_dup_udp_local_end (int fh); 
  • libroar/socket.c

    r5375 r5376  
    6767#endif 
    6868 
    69 int roar_socket_decnet_set_timeout (int fh, time_t sec, int_least32_t usec) { 
     69static int roar_socket_decnet_set_timeout (int fh, time_t sec, int_least32_t usec) { 
    7070#ifdef ROAR_HAVE_LIBDNET 
    7171 struct timeval timeout = {sec, usec}; 
     
    409409 
    410410 
    411 int roar_socket_listen_decnet (const char * object, int num) { 
     411static int roar_socket_listen_decnet (const char * object, int num) { 
    412412#ifdef ROAR_HAVE_LIBDNET 
    413413 int fh = roar_socket_new(ROAR_SOCKET_TYPE_DECNET); 
     
    417417  return -1; 
    418418 
    419  if ( !*object ) 
     419 if ( object != NULL && !*object ) 
    420420  object = NULL; 
    421421 
    422  if ( (object && num) || (!*object && !num) ) { 
     422 if ( (object != NULL && num) || (object != NULL && !*object && !num) || (object == NULL && !num) ) { 
    423423  ROAR_WARN("roar_socket_listen_decnet(object='%s', num=%i): illegal address!", object, num); 
    424424  close(fh); 
     425  roar_err_set(ROAR_ERROR_INVAL); 
    425426  return -1; 
    426427 } 
     
    442443 
    443444 if ( bind(fh, (struct sockaddr *) &bind_sockaddr, sizeof(bind_sockaddr)) == -1 ) { 
     445  roar_err_from_errno(); 
    444446  close(fh); 
    445447  return -1; 
     
    447449 
    448450 if ( listen(fh, 8) == -1 ) { 
     451  roar_err_from_errno(); 
    449452  close(fh); 
    450453  return -1; 
     
    453456 return fh; 
    454457#else 
     458 roar_err_set(ROAR_ERROR_NOSYS); 
    455459 return -1; 
    456460#endif 
     
    464468 
    465469 if ( !node[0] ) { 
    466   if ( (binaddr=getnodeadd()) == NULL) 
     470 
     471 // TODO: This does this function not use getnodename()? 
     472 
     473 // Those strange workarounds for the error codes are because those functions currently 
     474 // don't set errno. This way we will use errno as soon as it starts to set it. 
     475 
     476  roar_err_update(); 
     477  if ( (binaddr=getnodeadd()) == NULL) { 
     478   roar_err_update(); 
     479   if ( roar_error == ROAR_ERROR_NONE ) 
     480    roar_err_set(ROAR_ERROR_NOENT); 
    467481   return NULL; 
    468  
    469   if ( (dp=getnodebyaddr((char*)binaddr->a_addr, binaddr->a_len, AF_DECnet)) == NULL ) 
     482  } 
     483 
     484  roar_err_update(); 
     485  if ( (dp=getnodebyaddr((char*)binaddr->a_addr, binaddr->a_len, AF_DECnet)) == NULL ) { 
     486   roar_err_update(); 
     487   if ( roar_error == ROAR_ERROR_NONE ) 
     488    roar_err_set(ROAR_ERROR_NOENT); 
    470489   return NULL; 
     490  } 
    471491 
    472492  strncpy(node, dp->n_name, 15); 
     
    476496 return node; 
    477497#else 
     498 roar_err_set(ROAR_ERROR_AFNOTSUP); 
    478499 return NULL; 
    479500#endif 
Note: See TracChangeset for help on using the changeset viewer.