mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-10 05:59:45 -05:00
Fix event dispatching across platforms, clean up icon on win32, update installer template.
This commit is contained in:
@@ -44,6 +44,7 @@
|
||||
#include "err.h"
|
||||
#ifndef ERR_LEAN
|
||||
# include "os.h"
|
||||
# include "plugin.h"
|
||||
#endif
|
||||
|
||||
#ifndef PACKAGE
|
||||
@@ -154,7 +155,11 @@ void err_log(int level, unsigned int cat, char *fmt, ...)
|
||||
os_syslog(level,errbuf);
|
||||
os_closesyslog();
|
||||
}
|
||||
|
||||
|
||||
#ifndef ERR_LEAN
|
||||
plugin_event_dispatch(PLUGIN_EVENT_LOG, level, errbuf, (int)strlen(errbuf)+1);
|
||||
#endif
|
||||
|
||||
_err_unlock();
|
||||
|
||||
if(!level) {
|
||||
|
||||
@@ -128,7 +128,6 @@ int os_closesyslog(void) {
|
||||
* @return TRUE on success, FALSE otherwise
|
||||
*/
|
||||
int os_syslog(int level, char *msg) {
|
||||
plugin_event_dispatch(PLUGIN_EVENT_LOG, level, msg, (int)strlen(msg)+1);
|
||||
return elog_message(level, msg);
|
||||
}
|
||||
|
||||
|
||||
@@ -555,10 +555,10 @@ int plugin_auth_handle(WS_CONNINFO *pwsc, char *username, char *pw) {
|
||||
void plugin_event_dispatch(int event_id, int intval, void *vp, int len) {
|
||||
PLUGIN_ENTRY *ppi;
|
||||
|
||||
_plugin_readlock();
|
||||
/* FIXME: Something is wrong is readlock deadlocks... */
|
||||
// _plugin_readlock();
|
||||
ppi = _plugin_list.next;
|
||||
while(ppi) {
|
||||
fprintf(stderr,"Checking %s\n",ppi->pinfo->server);
|
||||
if(ppi->pinfo->type & PLUGIN_EVENT) {
|
||||
/* DPRINTF(E_DBG,L_PLUG,"Dispatching event %d to %s\n",
|
||||
event_id,ppi->versionstring); */
|
||||
@@ -569,7 +569,7 @@ void plugin_event_dispatch(int event_id, int intval, void *vp, int len) {
|
||||
}
|
||||
ppi=ppi->next;
|
||||
}
|
||||
_plugin_unlock();
|
||||
// _plugin_unlock();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,9 +11,6 @@ void plugin_handler(int, int, void *, int);
|
||||
|
||||
#define PIPE_BUFFER_SIZE 4096
|
||||
|
||||
#define USE_UDP 0
|
||||
#define USE_MAILSLOT 1
|
||||
|
||||
/* Globals */
|
||||
PLUGIN_EVENT_FN _pefn = { plugin_handler };
|
||||
PLUGIN_INPUT_FN *_ppi;
|
||||
@@ -43,46 +40,6 @@ PLUGIN_INFO *plugin_info(PLUGIN_INPUT_FN *ppi) {
|
||||
return &_pi;
|
||||
}
|
||||
|
||||
#if USE_UDP
|
||||
/** NO LOG IN HERE! We'll go into an endless loop. :) */
|
||||
void plugin_handler(int event_id, int intval, void *vp, int len) {
|
||||
int total_len = 3 * sizeof(int) + len + 1;
|
||||
PLUGIN_MSG *pmsg;
|
||||
int port = 9999;
|
||||
SOCKET sock;
|
||||
struct sockaddr_in servaddr;
|
||||
|
||||
pmsg = (PLUGIN_MSG*)malloc(total_len);
|
||||
if(!pmsg) {
|
||||
// _ppi->log(E_LOG,"Malloc error in w32-event.c/plugin_handler\n");
|
||||
return;
|
||||
}
|
||||
|
||||
memset(pmsg,0,total_len);
|
||||
pmsg->size = total_len;
|
||||
pmsg->event_id = event_id;
|
||||
pmsg->intval = intval;
|
||||
memcpy(&pmsg->vp,vp,len);
|
||||
|
||||
sock = socket(AF_INET,SOCK_DGRAM,0);
|
||||
if(sock == INVALID_SOCKET) {
|
||||
free(pmsg);
|
||||
return;
|
||||
}
|
||||
|
||||
servaddr.sin_family = AF_INET;
|
||||
servaddr.sin_addr.s_addr = inet_addr("127.0.0.1");
|
||||
servaddr.sin_port = htons(port);
|
||||
|
||||
sendto(sock,(char*)pmsg,total_len,0,(struct sockaddr *)&servaddr,sizeof(servaddr));
|
||||
|
||||
closesocket(sock);
|
||||
free(pmsg);
|
||||
return;
|
||||
}
|
||||
#endif /* USE_UDP */
|
||||
|
||||
#if USE_MAILSLOT
|
||||
#define MAILSLOT_NAME "\\\\.\\mailslot\\FireflyMediaServer--67A72768-4154-417e-BFA0-FA9B50C342DE"
|
||||
/** NO LOG IN HERE! We'll go into an endless loop. :) */
|
||||
void plugin_handler(int event_id, int intval, void *vp, int len) {
|
||||
@@ -120,4 +77,3 @@ void plugin_handler(int event_id, int intval, void *vp, int len) {
|
||||
CloseHandle(h);
|
||||
}
|
||||
}
|
||||
#endif /* USE_MAILSLOT */
|
||||
|
||||
@@ -138,7 +138,7 @@ void xml_update_config(WS_CONNINFO *pwsc) {
|
||||
}
|
||||
strcpy(badparms,arg);
|
||||
} else {
|
||||
badparms_len += strlen(arg) + 1;
|
||||
badparms_len += (int)strlen(arg) + 1;
|
||||
badparms = (char*)realloc(badparms,badparms_len);
|
||||
if(!badparms) {
|
||||
DPRINTF(E_FATAL,L_MISC,"xml_update_config: malloc\n");
|
||||
|
||||
Reference in New Issue
Block a user