Changeset 2715:efef3f8b01fb in roaraudio


Ignore:
Timestamp:
09/15/09 00:47:46 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

check if client got deleted

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roard/clients.c

    r2706 r2715  
    413413// int fh; 
    414414 int j; 
     415 int keep_going; 
    415416 
    416417 for (i = 0; i < ROAR_CLIENTS_MAX; i++) { 
    417418  if ( g_clients[i] == NULL ) 
    418419   continue; 
     420 
     421  keep_going = 1; 
    419422 
    420423/* 
     
    429432   // TODO: add some code to send a message to the client insetd of the raw data. 
    430433*/ 
    431    for (j = 0; j < ROAR_CLIENTS_MAX_STREAMS_PER_CLIENT; j++) { 
     434   for (j = 0; keep_going && j < ROAR_CLIENTS_MAX_STREAMS_PER_CLIENT; j++) { 
    432435    //if ( (fh = streams_get_fh(g_clients[i]->streams[j])) != -1 ) { 
     436    ROAR_DBG("clients_send_mon(*): client=%i, stream=%i -> ?", i, j); 
    433437    if ( g_clients[i]->streams[j] != -1 ) { 
    434438     ROAR_DBG("clients_send_mon(*): client=%i, stream=%i -> %i", i, j, g_clients[i]->streams[j]); 
    435439     streams_send_mon(g_clients[i]->streams[j]); 
     440 
     441     // the client may be deleted here, check if it still exists: 
     442     if ( g_clients[i] == NULL ) 
     443      keep_going = 0; 
    436444    } 
    437445   } 
Note: See TracChangeset for help on using the changeset viewer.