Roxen.git / server / modules / icecast / icecast.pike

version» Context lines:

Roxen.git/server/modules/icecast/icecast.pike:1:   inherit "module"; - constant cvs_version="$Id: icecast.pike,v 1.6 2001/04/11 14:05:46 per Exp $"; + constant cvs_version="$Id: icecast.pike,v 1.7 2001/04/17 04:34:09 per Exp $";   constant thread_safe=1;      #define BSIZE 8192   #define METAINTERVAL 4192      #include <module.h>   #include <roxen.h>   #include <stat.h>   #include <request_trace.h>   
Roxen.git/server/modules/icecast/icecast.pike:345:    "icy-br:"+(stream->bitrate/1000)+"\r\n"    "\r\n" );    }    if( initial )    i += initial;       conn += ({ Connection( id->my_fd, i,protocol,use_metadata,    stream,    lambda( Connection c ){    int pt = time()-c->connected; -  conn-=({c}); +  conn -= ({ c });    total_time += pt;    if( pt > max_time )    max_time = pt;    successful++;    connections--;    } ) });    return Roxen.http_pipe_in_progress( );    }       string format_time( int t )
Roxen.git/server/modules/icecast/icecast.pike:394:    {    string res = "<table>";    res += "<tr> <td colspan=2>"+    ""+stream->status()+"</td></tr>"    "<tr><td>Connections:</td><td>"+connections+"/"+max_connections+" ("+    accessed+" since server start, "+denied+" denied)</td></tr><tr>"    "<tr><td>Average listen time:</td><td>"+avg_listen_time()+"</td></tr>"    "<tr><td>Longest listen time:</td><td>"+longest_listen_time()+"</td></tr>"    "<tr><td>Current connections:</td><td>";    foreach( conn, Connection c ) +  catch {    res += " "+c->status()+"\n"; -  +  };    return res+"</td></tr></table>";    }      }      mapping(string:Location) locations = ([]);      int __id=1;      class Connection
Roxen.git/server/modules/icecast/icecast.pike:422:    int id = __id++;    array buffer = ({});    string current_block;    function _ccb;    mapping current_md;       int connected = time();       string status()    { +  if(!fd) +  return "Closed stream\n";    return sprintf( "%d. %s Time: %ds Remote: %s "    "%d sent, %d skipped<br />",id,protocol,    time()-connected,    (fd->query_address()/" ")[0],    sent, skipped );    }       string gen_metadata( )    {    if(!current_md )
Roxen.git/server/modules/icecast/icecast.pike:479:    if( (strlen( current_block ) + sent_bytes) - last_meta >= METAINTERVAL )    {    last_meta = (strlen( current_block ) + sent_bytes);    current_block += gen_metadata();    }    }    buffer = buffer[1..];    sent++;    }    int n = fd->write( current_block ); - // if( n < 0 && fd->errno() ) - // closed(); +     if( n > 0 )    {    if( headers_done )    sent_bytes += n;    current_block = current_block[n..];    } -  +  else if( n < 0 ) +  closed();    }       static void md_callback( mapping metadata )    {    current_md = metadata;    }       static void closed( )    {    fd->set_blocking( );
Roxen.git/server/modules/icecast/icecast.pike:515:    static void create( Stdio.File _fd, string buffer,    string prot, int _meta, MPEGStream _stream,    function _closed )    {    protocol = prot;    fd = _fd;    do_meta = _meta;    stream = _stream;    _ccb = _closed;    current_block = buffer; -  fd->set_nonblocking( 0, send_more, closed ); +  fd->set_nonblocking( lambda(){}, send_more, closed );    if( stream )    stream->add_callback( callback );    if( stream->playlist )    stream->playlist->add_md_callback( md_callback );    }   }         class VarStreams   {