X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fglobal.cpp;h=0437eb4c5893c79223a84f60de802474de6e1bbe;hb=f208e33c29132aacaec448e74341edea1b925a2a;hp=291f06b3117a11a002fff64f4c0a3a12275beacf;hpb=21f835f30b4e092c847bf4569a00995774f7330e;p=fms.git diff --git a/src/global.cpp b/src/global.cpp index 291f06b..0437eb4 100644 --- a/src/global.cpp +++ b/src/global.cpp @@ -6,6 +6,7 @@ #include "../include/db/sqlite3db.h" #include "../include/freenet/freenetmasterthread.h" #include "../include/nntp/nntplistener.h" +#include "../include/http/httpthread.h" #ifdef _WIN32 #include @@ -203,16 +204,14 @@ void SetupDB() );"); // low / high / message count for each board - db->Execute("DROP VIEW IF EXISTS vwBoardStats; \ - CREATE VIEW IF NOT EXISTS vwBoardStats AS \ + db->Execute("CREATE VIEW IF NOT EXISTS vwBoardStats AS \ SELECT tblBoard.BoardID AS 'BoardID', IFNULL(MIN(MessageID),0) AS 'LowMessageID', IFNULL(MAX(MessageID),0) AS 'HighMessageID', COUNT(MessageID) AS 'MessageCount' \ FROM tblBoard LEFT JOIN tblMessageBoard ON tblBoard.BoardID=tblMessageBoard.BoardID \ WHERE MessageID>=0 OR MessageID IS NULL \ GROUP BY tblBoard.BoardID;"); // calculates peer trust - db->Execute("DROP VIEW IF EXISTS vwCalculatedPeerTrust; \ - CREATE VIEW IF NOT EXISTS vwCalculatedPeerTrust AS \ + db->Execute("CREATE VIEW IF NOT EXISTS vwCalculatedPeerTrust AS \ SELECT TargetIdentityID, \ ROUND(SUM(MessageTrust*(LocalMessageTrust/100.0))/SUM(LocalMessageTrust/100.0),0) AS 'PeerMessageTrust', \ ROUND(SUM(TrustListTrust*(LocalTrustListTrust/100.0))/SUM(LocalTrustListTrust/100.0),0) AS 'PeerTrustListTrust' \ @@ -290,7 +289,7 @@ void SetupDB() // insert SomeDude's public key date.SetToGMTime(); - //db->Execute("INSERT INTO tblIdentity(PublicKey,DateAdded) VALUES('SSK@NuBL7aaJ6Cn4fB7GXFb9Zfi8w1FhPyW3oKgU9TweZMw,iXez4j3qCpd596TxXiJgZyTq9o-CElEuJxm~jNNZAuA,AQACAAE/','"+date.Format("%Y-%m-%d %H:%M:%S")+"');"); + db->Execute("INSERT INTO tblIdentity(PublicKey,DateAdded) VALUES('SSK@NuBL7aaJ6Cn4fB7GXFb9Zfi8w1FhPyW3oKgU9TweZMw,iXez4j3qCpd596TxXiJgZyTq9o-CElEuJxm~jNNZAuA,AQACAAE/','"+date.Format("%Y-%m-%d %H:%M:%S")+"');"); } @@ -334,7 +333,19 @@ void SetupDefaultOptions() // StartNNTP st.Bind(0,"StartNNTP"); st.Bind(1,"true"); - st.Bind(2,"Start NNTP service."); + st.Bind(2,"Start NNTP server."); + st.Step(); + st.Reset(); + + st.Bind(0,"StartHTTP"); + st.Bind(1,"true"); + st.Bind(2,"Start HTTP server."); + st.Step(); + st.Reset(); + + st.Bind(0,"HTTPListenPort"); + st.Bind(1,"8080"); + st.Bind(2,"Port HTTP server will listen on."); st.Step(); st.Reset(); @@ -347,7 +358,7 @@ void SetupDefaultOptions() // FCPHost st.Bind(0,"FCPHost"); - st.Bind(1,"localhost"); + st.Bind(1,"127.0.0.1"); st.Bind(2,"Host name or address of Freenet node."); st.Step(); st.Reset(); @@ -408,7 +419,7 @@ void SetupDefaultOptions() st.Reset(); st.Bind(0,"MinPeerMessageTrust"); - st.Bind(1,"25"); + st.Bind(1,"30"); st.Bind(2,"Specifies a peer message trust level that a peer must have before its messages will be downloaded."); st.Step(); st.Reset(); @@ -420,7 +431,7 @@ void SetupDefaultOptions() st.Reset(); st.Bind(0,"MinPeerTrustListTrust"); - st.Bind(1,"25"); + st.Bind(1,"30"); st.Bind(2,"Specifies a peer trust list trust level that a peer must have before its trust list will be included in the weighted average. Any peers below this number will be excluded from the results."); st.Step(); st.Reset(); @@ -516,6 +527,7 @@ void StartThreads(std::vector &threads) { std::string startfreenet; std::string startnntp; + std::string starthttp; if(Option::Instance()->Get("StartFreenetUpdater",startfreenet)==false) { @@ -529,6 +541,12 @@ void StartThreads(std::vector &threads) Option::Instance()->Set("StartNNTP","true"); } + if(Option::Instance()->Get("StartHTTP",starthttp)==false) + { + starthttp="true"; + Option::Instance()->Set("StartHTTP","true"); + } + if(startfreenet=="true") { PThread::Thread *t=new PThread::Thread(new FreenetMasterThread()); @@ -541,4 +559,10 @@ void StartThreads(std::vector &threads) threads.push_back(t); } + if(starthttp=="true") + { + PThread::Thread *t=new PThread::Thread(new HTTPThread()); + threads.push_back(t); + } + }