projects
/
paraslash.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e67fbca
)
vss: Check the afs socket either for reading or for writing.
author
Andre Noll
<maan@systemlinux.org>
Sat, 12 Apr 2008 06:19:01 +0000
(08:19 +0200)
committer
Andre Noll
<maan@systemlinux.org>
Sat, 12 Apr 2008 06:19:01 +0000
(08:19 +0200)
vss.c
patch
|
blob
|
history
diff --git
a/vss.c
b/vss.c
index a7542677249e14ad71182d8d276c55177e1c0ca7..3c59bf4ac09c78327dfeeff6cb4aba677ff1c19a 100644
(file)
--- a/
vss.c
+++ b/
vss.c
@@
-262,6
+262,19
@@
enum afs_socket_status {
static enum afs_socket_status afsss;
static enum afs_socket_status afsss;
+static int need_to_request_new_audio_file(void)
+{
+ if (map) /* have audio file */
+ return 0;
+ if (!vss_playing()) /* don't need one */
+ return 0;
+ if (mmd->new_vss_status_flags & VSS_NOMORE)
+ return 0;
+ if (afsss == AFS_SOCKET_AFD_PENDING) /* already requested one */
+ return 0;
+ return 1;
+}
+
/**
* Compute the timeout for para_server's main select-loop.
*
/**
* Compute the timeout for para_server's main select-loop.
*
@@
-288,7
+301,6
@@
struct timeval *vss_preselect(fd_set *rfds, fd_set *wfds, int *max_fileno)
int i;
struct timeval *tv;
int i;
struct timeval *tv;
- para_fd_set(afs_socket, rfds, max_fileno);
if (!map)
for (i = 0; senders[i].name; i++)
senders[i].shutdown_clients();
if (!map)
for (i = 0; senders[i].name; i++)
senders[i].shutdown_clients();
@@
-317,17
+329,13
@@
struct timeval *vss_preselect(fd_set *rfds, fd_set *wfds, int *max_fileno)
mmd->current_chunk = mmd->repos_request;
}
tv = vss_compute_timeout();
mmd->current_chunk = mmd->repos_request;
}
tv = vss_compute_timeout();
- if (tv)
- goto out;
- if (!map && vss_playing() &&
- !(mmd->new_vss_status_flags & VSS_NOMORE)) {
- if (afsss != AFS_SOCKET_AFD_PENDING) {
- PARA_DEBUG_LOG("ready and playing, but no audio file\n");
- para_fd_set(afs_socket, wfds, max_fileno);
- afsss = AFS_SOCKET_CHECK_FOR_WRITE;
- }
- }
out:
out:
+ if (need_to_request_new_audio_file()) {
+ PARA_DEBUG_LOG("ready and playing, but no audio file\n");
+ para_fd_set(afs_socket, wfds, max_fileno);
+ afsss = AFS_SOCKET_CHECK_FOR_WRITE;
+ } else
+ para_fd_set(afs_socket, rfds, max_fileno);
return tv;
}
return tv;
}
@@
-421,14
+429,18
@@
void vss_post_select(fd_set *rfds, fd_set *wfds)
{
int ret;
{
int ret;
- if (FD_ISSET(afs_socket, rfds))
- recv_afs_result();
- if (afsss != AFS_SOCKET_CHECK_FOR_WRITE || !FD_ISSET(afs_socket, wfds))
+ if (afsss != AFS_SOCKET_CHECK_FOR_WRITE) {
+ if (FD_ISSET(afs_socket, rfds))
+ recv_afs_result();
+ return;
+ }
+ if (!FD_ISSET(afs_socket, wfds))
return;
PARA_NOTICE_LOG("requesting new fd from afs\n");
ret = send_buffer(afs_socket, "new");
afsss = AFS_SOCKET_AFD_PENDING;
}
return;
PARA_NOTICE_LOG("requesting new fd from afs\n");
ret = send_buffer(afs_socket, "new");
afsss = AFS_SOCKET_AFD_PENDING;
}
+
/**
* Get the data of the given chunk.
*
/**
* Get the data of the given chunk.
*