mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-24 13:13:17 -05:00
More diag logging, move WS_PRIVATE into the WS_CONNINFO
This commit is contained in:
parent
14a508bc34
commit
938d54b055
@ -351,6 +351,8 @@ int daap_serialize(DAAP_BLOCK *root, int fd, int gzip) {
|
|||||||
}
|
}
|
||||||
free(uncompressed);
|
free(uncompressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DPRINTF(ERR_DEBUG,"Finished serializing\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -400,8 +402,12 @@ int daap_free(DAAP_BLOCK *root) {
|
|||||||
if(!root)
|
if(!root)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if((root->size)&&(root->free))
|
DPRINTF(ERR_DEBUG,"Freeing %c%c%c%c\n",root->tag[0],root->tag[1],
|
||||||
free(root->value);
|
root->tag[2],root->tag[3]);
|
||||||
|
|
||||||
|
if((root->size) && (root->free))
|
||||||
|
free(root->value); /* otherwise, static value */
|
||||||
|
|
||||||
daap_free(root->children);
|
daap_free(root->children);
|
||||||
daap_free(root->next);
|
daap_free(root->next);
|
||||||
free(root);
|
free(root);
|
||||||
|
@ -218,7 +218,7 @@ DAAP_BLOCK *daap_response_songlist(void) {
|
|||||||
DPRINTF(ERR_DEBUG,"Preparing to send db items\n");
|
DPRINTF(ERR_DEBUG,"Preparing to send db items\n");
|
||||||
|
|
||||||
henum=db_enum_begin();
|
henum=db_enum_begin();
|
||||||
if(!henum) {
|
if((!henum) && (db_get_song_count())) {
|
||||||
DPRINTF(ERR_DEBUG,"Can't get enum handle\n");
|
DPRINTF(ERR_DEBUG,"Can't get enum handle\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -229,6 +229,8 @@ void daap_handler(WS_CONNINFO *pwsc) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DPRINTF(ERR_DEBUG,"Finished serving DAAP response\n");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,7 +257,7 @@ int main(int argc, char *argv[]) {
|
|||||||
WSCONFIG ws_config;
|
WSCONFIG ws_config;
|
||||||
WSHANDLE server;
|
WSHANDLE server;
|
||||||
pid_t rendezvous_pid;
|
pid_t rendezvous_pid;
|
||||||
int use_mdns=1;
|
int use_mdns=0;
|
||||||
ENUMHANDLE handle;
|
ENUMHANDLE handle;
|
||||||
MP3FILE *pmp3;
|
MP3FILE *pmp3;
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
web_root ../admin-root
|
web_root ../admin-root
|
||||||
port 3689
|
port 3689
|
||||||
admin_pw secret
|
admin_pw secret
|
||||||
mp3_dir mp3/Type O Negative
|
mp3_dir mp3
|
||||||
|
servername Ron's Secret Stash
|
||||||
|
@ -73,6 +73,9 @@
|
|||||||
Change History (most recent first):
|
Change History (most recent first):
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.4 2003/11/20 21:58:22 ron
|
||||||
|
More diag logging, move WS_PRIVATE into the WS_CONNINFO
|
||||||
|
|
||||||
Revision 1.3 2003/11/17 16:40:09 ron
|
Revision 1.3 2003/11/17 16:40:09 ron
|
||||||
add support for named db
|
add support for named db
|
||||||
|
|
||||||
@ -295,7 +298,7 @@ enum {
|
|||||||
kDefaultPortNumber = 80
|
kDefaultPortNumber = 80
|
||||||
};
|
};
|
||||||
|
|
||||||
static mDNSBool gAvoidPort53 = mDNSfalse;
|
static mDNSBool gAvoidPort53 = mDNStrue;
|
||||||
static const char *gRichTextHostName = "";
|
static const char *gRichTextHostName = "";
|
||||||
static const char *gServiceType = kDefaultServiceType;
|
static const char *gServiceType = kDefaultServiceType;
|
||||||
static mDNSu8 gServiceText[sizeof(RDataBody)];
|
static mDNSu8 gServiceText[sizeof(RDataBody)];
|
||||||
|
@ -69,11 +69,6 @@ typedef struct tag_ws_private {
|
|||||||
pthread_t server_tid;
|
pthread_t server_tid;
|
||||||
} WS_PRIVATE;
|
} WS_PRIVATE;
|
||||||
|
|
||||||
typedef struct tag_ws_dispatchinfo {
|
|
||||||
WS_PRIVATE *pwsp;
|
|
||||||
WS_CONNINFO *pwsc;
|
|
||||||
} WS_DISPATCHINFO;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Forwards
|
* Forwards
|
||||||
*/
|
*/
|
||||||
@ -226,7 +221,6 @@ void *ws_mainthread(void *arg) {
|
|||||||
int fd;
|
int fd;
|
||||||
int err;
|
int err;
|
||||||
WS_PRIVATE *pwsp = (WS_PRIVATE*)arg;
|
WS_PRIVATE *pwsp = (WS_PRIVATE*)arg;
|
||||||
WS_DISPATCHINFO *pwsd;
|
|
||||||
WS_CONNINFO *pwsc;
|
WS_CONNINFO *pwsc;
|
||||||
pthread_t tid;
|
pthread_t tid;
|
||||||
char hostname[MAX_HOSTNAME];
|
char hostname[MAX_HOSTNAME];
|
||||||
@ -250,37 +244,26 @@ void *ws_mainthread(void *arg) {
|
|||||||
|
|
||||||
pwsc->hostname=strdup(hostname);
|
pwsc->hostname=strdup(hostname);
|
||||||
pwsc->fd=fd;
|
pwsc->fd=fd;
|
||||||
|
pwsc->pwsp = pwsp;
|
||||||
|
|
||||||
/* Spawn off a dispatcher to decide what to do with
|
/* Spawn off a dispatcher to decide what to do with
|
||||||
* the request
|
* the request
|
||||||
*/
|
*/
|
||||||
pwsd=(WS_DISPATCHINFO*)malloc(sizeof(WS_DISPATCHINFO));
|
|
||||||
if(!pwsd) {
|
/* don't really care if it locks or not */
|
||||||
/* keep on trucking until we crash bigger */
|
ws_lock_unsafe();
|
||||||
pwsc->error=EINVAL;
|
pwsc->threadno=pwsp->threadno;
|
||||||
DPRINTF(ERR_FATAL,"Error: %s\n",strerror(errno));
|
pwsp->threadno++;
|
||||||
free(pwsd);
|
ws_unlock_unsafe();
|
||||||
|
|
||||||
|
/* now, throw off a dispatch thread */
|
||||||
|
if(err=pthread_create(&tid,NULL,ws_dispatcher,(void*)pwsc)) {
|
||||||
|
pwsc->error=err;
|
||||||
|
DPRINTF(ERR_WARN,"Could not spawn thread: %s\n",strerror(err));
|
||||||
ws_close(pwsc);
|
ws_close(pwsc);
|
||||||
} else {
|
|
||||||
pwsd->pwsp=pwsp;
|
|
||||||
pwsd->pwsc=pwsc;
|
|
||||||
|
|
||||||
/* don't really care if it locks or not */
|
|
||||||
ws_lock_unsafe();
|
|
||||||
pwsc->threadno=pwsp->threadno;
|
|
||||||
pwsp->threadno++;
|
|
||||||
ws_unlock_unsafe();
|
|
||||||
|
|
||||||
/* now, throw off a dispatch thread */
|
|
||||||
if(err=pthread_create(&tid,NULL,ws_dispatcher,(void*)pwsd)) {
|
|
||||||
pwsc->error=err;
|
|
||||||
DPRINTF(ERR_WARN,"Could not spawn thread: %s\n",strerror(err));
|
|
||||||
free(pwsd);
|
|
||||||
ws_close(pwsc);
|
|
||||||
}
|
|
||||||
|
|
||||||
pthread_detach(tid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pthread_detach(tid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -514,9 +497,8 @@ int ws_getgetvars(WS_CONNINFO *pwsc, char *string) {
|
|||||||
* then decides what function should service the request
|
* then decides what function should service the request
|
||||||
*/
|
*/
|
||||||
void *ws_dispatcher(void *arg) {
|
void *ws_dispatcher(void *arg) {
|
||||||
WS_DISPATCHINFO *pwsd=(WS_DISPATCHINFO *)arg;
|
WS_CONNINFO *pwsc=(WS_CONNINFO*)arg;
|
||||||
WS_PRIVATE *pwsp=pwsd->pwsp;
|
WS_PRIVATE *pwsp=pwsc->pwsp;
|
||||||
WS_CONNINFO *pwsc=pwsd->pwsc;
|
|
||||||
char buffer[MAX_LINEBUFFER];
|
char buffer[MAX_LINEBUFFER];
|
||||||
char *buffp;
|
char *buffp;
|
||||||
char *first;
|
char *first;
|
||||||
@ -532,8 +514,6 @@ void *ws_dispatcher(void *arg) {
|
|||||||
void (*req_handler)(WS_CONNINFO*);
|
void (*req_handler)(WS_CONNINFO*);
|
||||||
int(*auth_handler)(char *, char *);
|
int(*auth_handler)(char *, char *);
|
||||||
|
|
||||||
free(pwsd);
|
|
||||||
|
|
||||||
DPRINTF(ERR_DEBUG,"Thread %d: Connection from %s\n",pwsc->threadno,
|
DPRINTF(ERR_DEBUG,"Thread %d: Connection from %s\n",pwsc->threadno,
|
||||||
pwsc->hostname);
|
pwsc->hostname);
|
||||||
|
|
||||||
|
@ -33,6 +33,9 @@
|
|||||||
* Typedefs
|
* Typedefs
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
typedef void* WSHANDLE;
|
||||||
|
|
||||||
typedef struct tag_wsconfig {
|
typedef struct tag_wsconfig {
|
||||||
char *web_root;
|
char *web_root;
|
||||||
char *id;
|
char *id;
|
||||||
@ -46,6 +49,7 @@ typedef struct tag_arglist {
|
|||||||
} ARGLIST;
|
} ARGLIST;
|
||||||
|
|
||||||
typedef struct tag_ws_conninfo {
|
typedef struct tag_ws_conninfo {
|
||||||
|
WSHANDLE pwsp;
|
||||||
int threadno;
|
int threadno;
|
||||||
int error;
|
int error;
|
||||||
int fd;
|
int fd;
|
||||||
@ -58,8 +62,6 @@ typedef struct tag_ws_conninfo {
|
|||||||
ARGLIST request_vars;
|
ARGLIST request_vars;
|
||||||
} WS_CONNINFO;
|
} WS_CONNINFO;
|
||||||
|
|
||||||
typedef void* WSHANDLE;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Externs
|
* Externs
|
||||||
*/
|
*/
|
||||||
@ -81,4 +83,5 @@ extern int ws_addresponseheader(WS_CONNINFO *pwsc, char *header, char *fmt, ...)
|
|||||||
extern int ws_writefd(WS_CONNINFO *pwsc, char *fmt, ...);
|
extern int ws_writefd(WS_CONNINFO *pwsc, char *fmt, ...);
|
||||||
extern char *ws_getvar(WS_CONNINFO *pwsc, char *var);
|
extern char *ws_getvar(WS_CONNINFO *pwsc, char *var);
|
||||||
extern int ws_testrequestheader(WS_CONNINFO *pwsc, char *header, char *value);
|
extern int ws_testrequestheader(WS_CONNINFO *pwsc, char *header, char *value);
|
||||||
|
|
||||||
#endif /* _WEBSERVER_H_ */
|
#endif /* _WEBSERVER_H_ */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user