Listener externalized

This commit is contained in:
Thulinma 2016-10-27 10:52:11 +02:00
parent 3a0beea1fc
commit 374c9fd0ff
3 changed files with 7 additions and 2 deletions

View file

@ -18,7 +18,7 @@ int main(int argc, char * argv[]) {
}
conf.activate();
if (mistOut::listenMode()){
conf.serveForkedSocket(spawnForked);
mistOut::listener(conf, spawnForked);
}else{
Socket::Connection S(fileno(stdout),fileno(stdin) );
mistOut tmp(S);

View file

@ -56,6 +56,10 @@ namespace Mist{
sentHeader = false;
}
void Output::listener(Util::Config & conf, int (*callback)(Socket::Connection & S)){
conf.serveForkedSocket(callback);
}
void Output::setBlocking(bool blocking){
isBlocking = blocking;
myConn.setBlocking(isBlocking);

View file

@ -41,7 +41,7 @@ namespace Mist {
static void init(Util::Config * cfg);
static JSON::Value capa;
//non-virtual generic functions
int run();
virtual int run();
virtual void stats(bool force = false);
void seek(unsigned long long pos);
bool seek(unsigned int tid, unsigned long long pos, bool getNextKey = false);
@ -62,6 +62,7 @@ namespace Mist {
bool prepareNext();
virtual void dropTrack(uint32_t trackId, std::string reason, bool probablyBad = true);
virtual void onRequest();
static void listener(Util::Config & conf, int (*callback)(Socket::Connection & S));
virtual void initialSeek();
virtual bool onFinish() {
return false;