Listener externalized
This commit is contained in:
parent
3a0beea1fc
commit
374c9fd0ff
3 changed files with 7 additions and 2 deletions
|
@ -18,7 +18,7 @@ int main(int argc, char * argv[]) {
|
||||||
}
|
}
|
||||||
conf.activate();
|
conf.activate();
|
||||||
if (mistOut::listenMode()){
|
if (mistOut::listenMode()){
|
||||||
conf.serveForkedSocket(spawnForked);
|
mistOut::listener(conf, spawnForked);
|
||||||
}else{
|
}else{
|
||||||
Socket::Connection S(fileno(stdout),fileno(stdin) );
|
Socket::Connection S(fileno(stdout),fileno(stdin) );
|
||||||
mistOut tmp(S);
|
mistOut tmp(S);
|
||||||
|
|
|
@ -55,6 +55,10 @@ namespace Mist{
|
||||||
}
|
}
|
||||||
sentHeader = false;
|
sentHeader = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Output::listener(Util::Config & conf, int (*callback)(Socket::Connection & S)){
|
||||||
|
conf.serveForkedSocket(callback);
|
||||||
|
}
|
||||||
|
|
||||||
void Output::setBlocking(bool blocking){
|
void Output::setBlocking(bool blocking){
|
||||||
isBlocking = blocking;
|
isBlocking = blocking;
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace Mist {
|
||||||
static void init(Util::Config * cfg);
|
static void init(Util::Config * cfg);
|
||||||
static JSON::Value capa;
|
static JSON::Value capa;
|
||||||
//non-virtual generic functions
|
//non-virtual generic functions
|
||||||
int run();
|
virtual int run();
|
||||||
virtual void stats(bool force = false);
|
virtual void stats(bool force = false);
|
||||||
void seek(unsigned long long pos);
|
void seek(unsigned long long pos);
|
||||||
bool seek(unsigned int tid, unsigned long long pos, bool getNextKey = false);
|
bool seek(unsigned int tid, unsigned long long pos, bool getNextKey = false);
|
||||||
|
@ -62,6 +62,7 @@ namespace Mist {
|
||||||
bool prepareNext();
|
bool prepareNext();
|
||||||
virtual void dropTrack(uint32_t trackId, std::string reason, bool probablyBad = true);
|
virtual void dropTrack(uint32_t trackId, std::string reason, bool probablyBad = true);
|
||||||
virtual void onRequest();
|
virtual void onRequest();
|
||||||
|
static void listener(Util::Config & conf, int (*callback)(Socket::Connection & S));
|
||||||
virtual void initialSeek();
|
virtual void initialSeek();
|
||||||
virtual bool onFinish() {
|
virtual bool onFinish() {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue