diff options
Diffstat (limited to 'vfg/src/Asterisk.cpp')
| -rwxr-xr-x | vfg/src/Asterisk.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/vfg/src/Asterisk.cpp b/vfg/src/Asterisk.cpp index 55a77e0..9d94138 100755 --- a/vfg/src/Asterisk.cpp +++ b/vfg/src/Asterisk.cpp @@ -65,7 +65,6 @@ void Asterisk::setup(string passcode,int millis){ udpConnection.Bind(5000);
udpConnection.SetNonBlocking(true);
cmd("ssh 80.93.22.22 'sudo /usr/sbin/asterisk -rx \"database put GAME passcode "+passcode+"\"'");
- state=ASTERISK_WAITING; //for acknowledge
statusPollMillis=millis;
if (statusPollMillis>0) startThread(false, false); // blocking, verbose
}
@@ -83,9 +82,8 @@ void Asterisk::endGame(string score){ if (state==ASTERISK_PLAYING) {
//cmd("ssh 80.93.22.22 'sudo /usr/sbin/asterisk -rx \"database put GAME statuscode "+score+"\"'");
string emsg="ssh 80.93.22.22 'sudo /usr/sbin/asterisk -rx \"hangup request "+playerCode+"\"'";
- scmd(emsg);
+ cmd(emsg);
printf("Asterisk: hanging up %s\n",playerCode.c_str());
- state=ASTERISK_IDLE;
}
}
void Asterisk::cmd(string s) {
@@ -95,7 +93,7 @@ void Asterisk::cmd(string s) { file = popen(s.c_str(), "re"); //"e" seems necessary for non blocking but with it getting crash when dequeuing. can't seem to trace it
filenum=fileno(file);
fcntl(filenum, F_SETFL, O_NONBLOCK); - state=ASTERISK_WAITING;
+ state=ASTERISK_WAITING;
} void Asterisk::scmd(string s) {
@@ -106,7 +104,7 @@ void Asterisk::scmd(string s) { filenum=fileno(file);
fcntl(filenum, F_SETFL, O_NONBLOCK); //printf("close file\n");
- pclose(file);
+ pclose(file); //is blocking!
} |
