Permalink
Browse files

curl cleanup, lan docs

  • Loading branch information...
1 parent ce1fa81 commit c0d064f8fe55f4bf637e0d686ffef28711aedb41 @RJ committed Jul 18, 2009
Showing with 36 additions and 12 deletions.
  1. +6 −8 includes/playdar/resolver_query.hpp
  2. +2 −1 includes/playdar/ss_curl.hpp
  3. +25 −2 resolvers/lan/README.txt
  4. +3 −1 src/playdar_request_handler.cpp
@@ -182,10 +182,9 @@ class ResolverQuery
{
if (!m_cancelled) {
boost::mutex::scoped_lock lock(m_mut);
- // may as well still collect results, even if solved:
- //if (rip->score() == 1.0) {
- // m_solved = true;
- //}
+ if (rip->score() == 1.0) {
+ m_solved = true;
+ }
m_results.push_back(rip);
// fire callbacks:
BOOST_FOREACH(rq_callback_t & cb, m_callbacks) {
@@ -206,10 +205,9 @@ class ResolverQuery
BOOST_FOREACH(const ri_ptr& rip, results) {
// decide if this result "solves" the query:
// for now just assume score of 1 means solved.
- // may as wel still collect results, even if solved:
- //if(rip->score() == 1.0) {
- // m_solved = true;
- //}
+ if(rip->score() == 1.0) {
+ m_solved = true;
+ }
// fire callbacks:
BOOST_FOREACH(rq_callback_t & cb, m_callbacks) {
cb(id(), rip);
@@ -199,8 +199,9 @@ class CurlStreamingStrategy
if (m_curlres) {
std::cout << "Curl error: " << m_curlerror << std::endl;
m_reply->write_cancel();
+ } else {
+ m_reply->write_finish();
}
- m_reply->write_finish();
curl_easy_cleanup( m_curl );
}
View
@@ -1,2 +1,25 @@
-Broadcasts searches on the LAN using UDP multicast.
-Streams results using normal HTTP requests.
+The LAN plugin broadcasts searches using UDP multicast.
+Results are streamed over HTTP using the address the UDP result came from.
+It should just automatically work on home/small office networks.
+--
+By default you don't need anything in the config file for this plugin, however:
+
+ "lan" :
+ {
+ "listenip" : "your.lan.ip.address",
+ "listenport" : 8888,
+ "endpoints" : ["239.255.0.1", "10.1.2.3", "192.168.1.1"]
+ }
+
+* If you change the "listenport", it'll only work with others on the same port.
+
+* "listenip" might be useful if you have lots of interfaces.
+
+* endpoints are where to send udp msgs to. The first, and default, is the
+ udp multicast address, which will be sent to the entire subnet.
+ If you have multicast disabled, or multiple subnets, or some other exotic
+ network configuration, you can put multicast addresses, or addresses of other
+ hosts known to be running playdar in there. This means you can target any
+ machine you can reach on the LAN, despite multicast not working.
+
+* to change endpoint ports too: "endpoints" : [ ["10.1.2.3",1234], [..] ]
@@ -53,7 +53,7 @@ playdar_request_handler::init(MyApplication * app)
{
m_disableAuth = app->conf()->get<bool>( "disableauth", false );
cout << "HTTP handler online." << endl;
- m_pauth = new playdar::auth(app->conf()->get<string>( "authdb", "" ));
+ m_pauth = new playdar::auth(app->conf()->get<string>( "authdb", "auth.db" ));
m_app = app;
// built-in handlers:
m_urlHandlers[ "" ] = boost::bind( &playdar_request_handler::handle_root, this, _1, _2 );
@@ -217,6 +217,8 @@ void
playdar_request_handler::handle_crossdomain( const playdar_request& req,
moost::http::reply& rep)
{
+ // TODO FIXME doesn't this mean flash movies can read your localhost
+ // config gui?
ostringstream os;
os << "<?xml version=\"1.0\"?>" << endl
<< "<!DOCTYPE cross-domain-policy SYSTEM \"http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd\">"

0 comments on commit c0d064f

Please sign in to comment.