mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-24 22:25:56 -05:00
fix windows blocking socket issue, work around problem with temp update table not being seen by fetch thread during db update
This commit is contained in:
parent
c8d09bc310
commit
e842f38fce
@ -933,7 +933,8 @@ int db_sql_add(char **pe, MP3FILE *pmp3, int *id) {
|
||||
|
||||
insertid = db_sql_insert_id_fn();
|
||||
if((db_sql_in_scan || db_sql_in_playlist_scan)&&(!db_sql_reload)) {
|
||||
db_sql_exec_fn(NULL,E_FATAL,"insert into updated values (%d)",
|
||||
/* fetch threads have different sqlite handle -- won't see the update table */
|
||||
db_sql_exec_fn(NULL,E_DBG,"insert into updated values (%d)",
|
||||
insertid);
|
||||
}
|
||||
|
||||
@ -1564,7 +1565,7 @@ MP3FILE *db_sql_fetch_item(char **pe, int id) {
|
||||
db_sql_dispose_row();
|
||||
|
||||
if ((db_sql_in_scan || db_sql_in_playlist_scan) && (!db_sql_reload)) {
|
||||
db_sql_exec_fn(pe,E_FATAL,"INSERT INTO updated VALUES (%d)",id);
|
||||
db_sql_exec_fn(pe,E_DBG,"INSERT INTO updated VALUES (%d)",id);
|
||||
}
|
||||
|
||||
return pmp3;
|
||||
@ -1614,7 +1615,7 @@ MP3FILE *db_sql_fetch_path(char **pe, char *path, int index) {
|
||||
db_sql_dispose_row();
|
||||
|
||||
if ((db_sql_in_scan || db_sql_in_playlist_scan) && (!db_sql_reload)) {
|
||||
db_sql_exec_fn(pe,E_FATAL,"INSERT INTO updated VALUES (%d)",pmp3->id);
|
||||
db_sql_exec_fn(pe,E_DBG,"INSERT INTO updated VALUES (%d)",pmp3->id);
|
||||
}
|
||||
|
||||
return pmp3;
|
||||
|
11
src/io.c
11
src/io.c
@ -370,7 +370,7 @@ int io_init(void) {
|
||||
io_handler_list.next = NULL;
|
||||
|
||||
#ifdef WIN32
|
||||
wVersionRequested = MAKEWORD(2,0);
|
||||
wVersionRequested = MAKEWORD(2,2);
|
||||
err = WSAStartup(wVersionRequested, &io_WSAData);
|
||||
if(err) {
|
||||
io_err_printf(IO_LOG_FATAL,"Could not initialize winsock\n");
|
||||
@ -2309,14 +2309,19 @@ int io_socket_write(IO_PRIVHANDLE *phandle, unsigned char *buf,uint32_t *len) {
|
||||
byteswritten = send(priv->fd, bufp, bytestowrite, 0);
|
||||
}
|
||||
|
||||
io_err_printf(IO_LOG_DEBUG,"wrote %d bytes to socket %d\n",byteswritten,priv->fd);
|
||||
io_err_printf(IO_LOG_SPAM,"wrote %d bytes to socket %d\n",byteswritten,priv->fd);
|
||||
|
||||
#ifdef WIN32
|
||||
if(WSAGetLastError() == WSAEWOULDBLOCK) {
|
||||
byteswritten = 0;
|
||||
|
||||
if(priv->hEvent) {
|
||||
WSAEventSelect(priv->fd,(WSAEVENT)priv->hEvent,0);
|
||||
}
|
||||
|
||||
blocking = 0;
|
||||
if(ioctlsocket(priv->fd,FIONBIO,&blocking)) {
|
||||
io_err_printf(IO_LOG_LOG,"Couldn't set socket to blocking\n");
|
||||
io_err_printf(IO_LOG_LOG,"Couldn't set socket to blocking: %ld\n",WSAGetLastError());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user