Reduce verbosity to releaseable levels.
This commit is contained in:
parent
860fbe0b53
commit
6a6b37fc27
5 changed files with 13 additions and 11 deletions
|
@ -48,7 +48,9 @@ namespace Buffer{
|
|||
|
||||
void handleUser(void * v_usr){
|
||||
user * usr = (user*)v_usr;
|
||||
#if DEBUG >= 4
|
||||
std::cerr << "Thread launched for user " << usr->MyStr << ", socket number " << usr->S.getSocket() << std::endl;
|
||||
#endif
|
||||
|
||||
usr->myRing = thisStream->getRing();
|
||||
usr->S.Send(thisStream->getHeader());
|
||||
|
@ -89,7 +91,6 @@ namespace Buffer{
|
|||
}
|
||||
usr->Disconnect("Socket closed.");
|
||||
thisStream->cleanUsers();
|
||||
std::cerr << "User " << usr->MyStr << " disconnected, socket number " << usr->S.getSocket() << std::endl;
|
||||
}
|
||||
|
||||
/// Loop reading DTSC data from stdin and processing it at the correct speed.
|
||||
|
|
|
@ -128,14 +128,18 @@ void Buffer::Stream::saveStats(std::string username, Stats & stats){
|
|||
/// Stores final statistics.
|
||||
void Buffer::Stream::clearStats(std::string username, Stats & stats, std::string reason){
|
||||
stats_mutex.lock();
|
||||
Storage["curr"].removeMember(username);
|
||||
if (Storage["curr"].isMember(username)){
|
||||
Storage["curr"].removeMember(username);
|
||||
#if DEBUG >= 4
|
||||
std::cout << "Disconnected user " << username << ": " << reason << ". " << stats.connector << " transferred " << stats.up << " up and " << stats.down << " down in " << stats.conntime << " seconds to " << stats.host << std::endl;
|
||||
#endif
|
||||
}
|
||||
Storage["log"][username]["connector"] = stats.connector;
|
||||
Storage["log"][username]["up"] = stats.up;
|
||||
Storage["log"][username]["down"] = stats.down;
|
||||
Storage["log"][username]["conntime"] = stats.conntime;
|
||||
Storage["log"][username]["host"] = stats.host;
|
||||
Storage["log"][username]["start"] = (unsigned int)time(0) - stats.conntime;
|
||||
std::cout << "Disconnected user " << username << ": " << reason << ". " << stats.connector << " transferred " << stats.up << " up and " << stats.down << " down in " << stats.conntime << " seconds to " << stats.host << std::endl;
|
||||
stats_mutex.unlock();
|
||||
cleanUsers();
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ Buffer::user::user(Socket::Connection fd){
|
|||
currsend = 0;
|
||||
myRing = 0;
|
||||
Thread = 0;
|
||||
std::cout << "User " << MyNum << " connected" << std::endl;
|
||||
}//constructor
|
||||
|
||||
/// Drops held DTSC::Ring class, if one is held.
|
||||
|
@ -65,7 +64,7 @@ void Buffer::user::Send(){
|
|||
}//still waiting for next buffer?
|
||||
if (myRing->starved){
|
||||
//if corrupt data, warn and get new DTSC::Ring
|
||||
std::cout << "Warning: User was send corrupt video data and send to the next keyframe!" << std::endl;
|
||||
std::cout << "Warning: User " << MyNum << " was send corrupt video data and send to the next keyframe!" << std::endl;
|
||||
Stream::get()->dropRing(myRing);
|
||||
myRing = Stream::get()->getRing();
|
||||
return;
|
||||
|
|
|
@ -59,21 +59,17 @@ namespace Connector_HTTP{
|
|||
void Timeout_Thread(void * n){
|
||||
n = 0;//prevent unused variable warning
|
||||
tthread::lock_guard<tthread::mutex> guard(timeout_mutex);
|
||||
std::cout << "Started timeout thread" << std::endl;
|
||||
while (true){
|
||||
{
|
||||
tthread::lock_guard<tthread::mutex> guard(conn_mutex);
|
||||
if (connconn.empty()){
|
||||
std::cout << "No more connections" << std::endl;
|
||||
return;
|
||||
}
|
||||
std::cout << "Currently " << connconn.size() << " active connections" << std::endl;
|
||||
std::map<std::string, ConnConn*>::iterator it;
|
||||
for (it = connconn.begin(); it != connconn.end(); it++){
|
||||
if (!it->second->conn->connected() || it->second->lastuse++ > 15){
|
||||
if (it->second->in_use.try_lock()){
|
||||
it->second->in_use.unlock();
|
||||
std::cout << "Murdered one" << std::endl;
|
||||
delete it->second;
|
||||
connconn.erase(it);
|
||||
it = connconn.begin();//get a valid iterator
|
||||
|
@ -273,7 +269,6 @@ namespace Connector_HTTP{
|
|||
HTTP::Parser Client;
|
||||
while (conn->connected()){
|
||||
if (conn->spool()){
|
||||
std::cout << "Data: " << conn->Received() << std::endl;
|
||||
if (Client.Read(conn->Received())){
|
||||
std::string handler = getHTTPType(Client);
|
||||
#if DEBUG >= 4
|
||||
|
@ -289,7 +284,6 @@ namespace Connector_HTTP{
|
|||
Handle_Through_Connector(Client, conn, handler);
|
||||
}
|
||||
Client.Clean(); //clean for any possible next requests
|
||||
std::cout << "Request handled" << std::endl;
|
||||
}else{
|
||||
#if DEBUG >= 3
|
||||
fprintf(stderr, "Could not parse the following:\n%s\n", conn->Received().c_str());
|
||||
|
|
|
@ -68,7 +68,9 @@ namespace Connector_HTTP{
|
|||
|
||||
std::string Result;
|
||||
Result.append((char*)abst.GetBoxedData(), (int)abst.GetBoxedDataSize());
|
||||
#if DEBUG >= 4
|
||||
std::cout << "Sending bootstrap:" << std::endl << abst.toPrettyString(0) << std::endl;
|
||||
#endif
|
||||
return Base64::encode(Result);
|
||||
}
|
||||
|
||||
|
@ -101,7 +103,9 @@ namespace Connector_HTTP{
|
|||
"<media streamId=\"1\" bootstrapInfoId=\"bootstrap1\" url=\"" + MovieId + "/\"></media>\n"
|
||||
"</manifest>\n";
|
||||
}
|
||||
#if DEBUG >= 4
|
||||
std::cerr << "Sending this manifest:" << std::endl << Result << std::endl;
|
||||
#endif
|
||||
return Result;
|
||||
}//BuildManifest
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue