mirror of
				https://github.com/SuperBFG7/ympd
				synced 2025-10-31 22:03:01 +00:00 
			
		
		
		
	Fix: cleanups
This commit is contained in:
		| @@ -15,6 +15,7 @@ else() | |||||||
| endif() | endif() | ||||||
|  |  | ||||||
| find_package(LibMPDClient REQUIRED) | find_package(LibMPDClient REQUIRED) | ||||||
|  | find_package(Threads REQUIRED) | ||||||
|  |  | ||||||
| configure_file(src/config.h.in ${PROJECT_BINARY_DIR}/config.h) | configure_file(src/config.h.in ${PROJECT_BINARY_DIR}/config.h) | ||||||
| include_directories(${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}	${LIBMPDCLIENT_INCLUDE_DIR}) | include_directories(${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}	${LIBMPDCLIENT_INCLUDE_DIR}) | ||||||
| @@ -41,7 +42,7 @@ set(SOURCES | |||||||
| ) | ) | ||||||
|  |  | ||||||
| add_executable(mympd ${SOURCES}) | add_executable(mympd ${SOURCES}) | ||||||
| target_link_libraries(mympd ${LIBMPDCLIENT_LIBRARY} ${OPENSSL_LIBRARIES}) | target_link_libraries(mympd ${LIBMPDCLIENT_LIBRARY} ${OPENSSL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) | ||||||
|  |  | ||||||
| install(TARGETS mympd DESTINATION bin) | install(TARGETS mympd DESTINATION bin) | ||||||
| install(FILES contrib/mympd.1 DESTINATION share/man/man1) | install(FILES contrib/mympd.1 DESTINATION share/man/man1) | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								dist/htdocs/sw.min.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/htdocs/sw.min.js
									
									
									
									
										vendored
									
									
								
							| @@ -10,5 +10,5 @@ function(){function a(a){return function(d){c||(c=!0,a.call(b,d))}}var b=this,c= | |||||||
| void 0;try{d=a.then}catch(h){this.reject_(h);return}"function"==typeof d?this.settleSameAsThenable_(d,a):this.fulfill_(a)};c.prototype.reject_=function(a){this.settle_(2,a)};c.prototype.fulfill_=function(a){this.settle_(1,a)};c.prototype.settle_=function(a,b){if(0!=this.state_)throw Error("Cannot settle("+a+", "+b+"): Promise already settled in state"+this.state_);this.state_=a;this.result_=b;this.executeOnSettledCallbacks_()};c.prototype.executeOnSettledCallbacks_=function(){if(null!=this.onSettledCallbacks_){for(var a= | void 0;try{d=a.then}catch(h){this.reject_(h);return}"function"==typeof d?this.settleSameAsThenable_(d,a):this.fulfill_(a)};c.prototype.reject_=function(a){this.settle_(2,a)};c.prototype.fulfill_=function(a){this.settle_(1,a)};c.prototype.settle_=function(a,b){if(0!=this.state_)throw Error("Cannot settle("+a+", "+b+"): Promise already settled in state"+this.state_);this.state_=a;this.result_=b;this.executeOnSettledCallbacks_()};c.prototype.executeOnSettledCallbacks_=function(){if(null!=this.onSettledCallbacks_){for(var a= | ||||||
| 0;a<this.onSettledCallbacks_.length;++a)l.asyncExecute(this.onSettledCallbacks_[a]);this.onSettledCallbacks_=null}};var l=new b;c.prototype.settleSameAsPromise_=function(a){var b=this.createResolveAndReject_();a.callWhenSettled_(b.resolve,b.reject)};c.prototype.settleSameAsThenable_=function(a,b){var c=this.createResolveAndReject_();try{a.call(b,c.resolve,c.reject)}catch(k){c.reject(k)}};c.prototype.then=function(a,b){function d(a,b){return"function"==typeof a?function(b){try{f(a(b))}catch(m){e(m)}}: | 0;a<this.onSettledCallbacks_.length;++a)l.asyncExecute(this.onSettledCallbacks_[a]);this.onSettledCallbacks_=null}};var l=new b;c.prototype.settleSameAsPromise_=function(a){var b=this.createResolveAndReject_();a.callWhenSettled_(b.resolve,b.reject)};c.prototype.settleSameAsThenable_=function(a,b){var c=this.createResolveAndReject_();try{a.call(b,c.resolve,c.reject)}catch(k){c.reject(k)}};c.prototype.then=function(a,b){function d(a,b){return"function"==typeof a?function(b){try{f(a(b))}catch(m){e(m)}}: | ||||||
| b}var f,e,g=new c(function(a,b){f=a;e=b});this.callWhenSettled_(d(a,f),d(b,e));return g};c.prototype.catch=function(a){return this.then(void 0,a)};c.prototype.callWhenSettled_=function(a,b){function c(){switch(d.state_){case 1:a(d.result_);break;case 2:b(d.result_);break;default:throw Error("Unexpected state: "+d.state_);}}var d=this;null==this.onSettledCallbacks_?l.asyncExecute(c):this.onSettledCallbacks_.push(c)};c.resolve=f;c.reject=function(a){return new c(function(b,c){c(a)})};c.race=function(a){return new c(function(b, | b}var f,e,g=new c(function(a,b){f=a;e=b});this.callWhenSettled_(d(a,f),d(b,e));return g};c.prototype.catch=function(a){return this.then(void 0,a)};c.prototype.callWhenSettled_=function(a,b){function c(){switch(d.state_){case 1:a(d.result_);break;case 2:b(d.result_);break;default:throw Error("Unexpected state: "+d.state_);}}var d=this;null==this.onSettledCallbacks_?l.asyncExecute(c):this.onSettledCallbacks_.push(c)};c.resolve=f;c.reject=function(a){return new c(function(b,c){c(a)})};c.race=function(a){return new c(function(b, | ||||||
| c){for(var d=$jscomp.makeIterator(a),e=d.next();!e.done;e=d.next())f(e.value).callWhenSettled_(b,c)})};c.all=function(a){var b=$jscomp.makeIterator(a),d=b.next();return d.done?f([]):new c(function(a,c){function e(b){return function(c){g[b]=c;h--;0==h&&a(g)}}var g=[],h=0;do g.push(void 0),h++,f(d.value).callWhenSettled_(e(g.length-1),c),d=b.next();while(!d.done)})};return c},"es6","es3");var CACHE="myMPD-cache-v4.7.2",urlsToCache="/ /player.html /css/bootstrap.min.css /css/mympd.min.css /js/bootstrap-native-v4.min.js /js/mympd.min.js /js/player.min.js /js/keymap.min.js /assets/appicon-167.png /assets/appicon-192.png /assets/appicon-512.png /assets/coverimage-httpstream.png /assets/coverimage-notavailable.png /assets/coverimage-loading.png /assets/favicon.ico /assets/MaterialIcons-Regular.ttf /assets/MaterialIcons-Regular.woff /assets/MaterialIcons-Regular.woff2".split(" "); | c){for(var d=$jscomp.makeIterator(a),e=d.next();!e.done;e=d.next())f(e.value).callWhenSettled_(b,c)})};c.all=function(a){var b=$jscomp.makeIterator(a),d=b.next();return d.done?f([]):new c(function(a,c){function e(b){return function(c){g[b]=c;h--;0==h&&a(g)}}var g=[],h=0;do g.push(void 0),h++,f(d.value).callWhenSettled_(e(g.length-1),c),d=b.next();while(!d.done)})};return c},"es6","es3");var CACHE="myMPD-cache-v5.0.0",urlsToCache="/ /player.html /css/bootstrap.min.css /css/mympd.min.css /js/bootstrap-native-v4.min.js /js/mympd.min.js /js/player.min.js /js/keymap.min.js /assets/appicon-167.png /assets/appicon-192.png /assets/appicon-512.png /assets/coverimage-httpstream.png /assets/coverimage-notavailable.png /assets/coverimage-loading.png /assets/favicon.ico /assets/MaterialIcons-Regular.ttf /assets/MaterialIcons-Regular.woff /assets/MaterialIcons-Regular.woff2".split(" "); | ||||||
| self.addEventListener("install",function(a){a.waitUntil(caches.open(CACHE).then(function(a){return a.addAll(urlsToCache)}))});self.addEventListener("fetch",function(a){if(a.request.url.match("^http://"))return!1;a.respondWith(caches.match(a.request).then(function(b){return b?b:fetch(a.request)}))});self.addEventListener("activate",function(a){a.waitUntil(caches.keys().then(function(a){return Promise.all(a.map(function(a){if(a!=CACHE)return caches.delete(a)}))}))}); | self.addEventListener("install",function(a){a.waitUntil(caches.open(CACHE).then(function(a){return a.addAll(urlsToCache)}))});self.addEventListener("fetch",function(a){if(a.request.url.match("^http://"))return!1;a.respondWith(caches.match(a.request).then(function(b){return b?b:fetch(a.request)}))});self.addEventListener("activate",function(a){a.waitUntil(caches.keys().then(function(a){return Promise.all(a.map(function(a){if(a!=CACHE)return caches.delete(a)}))}))}); | ||||||
|   | |||||||
| @@ -25,7 +25,6 @@ | |||||||
| #ifndef __MPD_CLIENT_H__ | #ifndef __MPD_CLIENT_H__ | ||||||
| #define __MPD_CLIENT_H__ | #define __MPD_CLIENT_H__ | ||||||
|  |  | ||||||
| #include "../dist/src/mongoose/mongoose.h" |  | ||||||
| #include "common.h" | #include "common.h" | ||||||
| #include "web_server.h" | #include "web_server.h" | ||||||
| #include "list.h" | #include "list.h" | ||||||
|   | |||||||
							
								
								
									
										18
									
								
								src/mympd.c
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								src/mympd.c
									
									
									
									
									
								
							| @@ -299,8 +299,7 @@ bool testdir(char *name, char *dirname) { | |||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| void *mpd_client_thread(void *arg) { | void *mpd_client_thread() { | ||||||
|     struct mg_mgr *mgr = (struct mg_mgr *) arg; |  | ||||||
|     while (s_signal_received == 0) { |     while (s_signal_received == 0) { | ||||||
|         mympd_idle(100); |         mympd_idle(100); | ||||||
|     } |     } | ||||||
| @@ -511,23 +510,16 @@ int main(int argc, char **argv) { | |||||||
|         LOG_INFO() printf("Listening on ssl port %s\n", config.sslport); |         LOG_INFO() printf("Listening on ssl port %s\n", config.sslport); | ||||||
|  |  | ||||||
|     pthread_t mpd_client, web_server; |     pthread_t mpd_client, web_server; | ||||||
|     pthread_create(&mpd_client, NULL, mpd_client_thread, &mgr); |     pthread_create(&mpd_client, NULL, mpd_client_thread, NULL); | ||||||
|     pthread_create(&web_server, NULL, web_server_thread, &mgr); |     pthread_create(&web_server, NULL, web_server_thread, &mgr); | ||||||
|  |  | ||||||
|     //Do nothing... |     //Do nothing... | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     //clean up | ||||||
|  |     //todo: destroy tiny queues | ||||||
|     pthread_join(mpd_client, NULL); |     pthread_join(mpd_client, NULL); | ||||||
|     pthread_join(web_server, NULL); |     pthread_join(web_server, NULL); | ||||||
|  |  | ||||||
| /* |  | ||||||
|     mg_start_thread(mpd_client_thread, &mgr); |  | ||||||
|  |  | ||||||
|     while (s_signal_received == 0) { |  | ||||||
|         mg_mgr_poll(&mgr, 100); |  | ||||||
|     } |  | ||||||
|     mg_mgr_free(&mgr); |  | ||||||
| */ |  | ||||||
|  |  | ||||||
|     list_free(&mpd_tags); |     list_free(&mpd_tags); | ||||||
|     list_free(&mympd_tags); |     list_free(&mympd_tags); | ||||||
|     return EXIT_SUCCESS; |     return EXIT_SUCCESS; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 jcorporation
					jcorporation