Changeset 579:2c1678ae3911 in roaraudio


Ignore:
Timestamp:
08/19/08 14:50:04 (16 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added code to support server restart (--restart)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roard/roard.c

    r576 r579  
    7373// printf("\n Options:\n\n"); 
    7474 printf("\n"); 
     75} 
     76 
     77int restart_server (char * server) { 
     78 struct roar_connection con; 
     79 if ( roar_connect(&con, server) == -1 ) { 
     80  return -1; 
     81 } 
     82 
     83 if ( roar_terminate(&con, 1) == -1 ) { 
     84  return -1; 
     85 } 
     86 
     87 return roar_disconnect(&con); 
    7588} 
    7689 
     
    160173   return 0; 
    161174 
     175  } else if ( strcmp(k, "--restart") == 0 ) { 
     176   if ( restart_server(server) == -1 ) { 
     177    ROAR_WARN("Can not terminate old server (not running at %s?), tring to continue anyway", server); 
     178   } 
     179 
    162180  } else if ( strcmp(k, "--demon") == 0 ) { 
    163181   demon = 1; 
Note: See TracChangeset for help on using the changeset viewer.