Modify data-xfer semantics: it is no longer necessary to call one of

request(), seek() or deliver_xxx() in order to start the data flow.
Autonomous generators must be genuinely autonomous (having their own
process), or otherwise arrange to be called.  TCP does this by
starting the retry timer immediately.

Add some debugging statements.
This commit is contained in:
Michael Brown
2007-05-26 15:04:36 +00:00
parent 3601103381
commit 10d0a1f8c7
5 changed files with 96 additions and 41 deletions

View File

@@ -191,6 +191,7 @@ static int posix_find_free_fd ( void ) {
if ( ! posix_fd_to_file ( fd ) )
return fd;
}
DBG ( "POSIX could not find free file descriptor\n" );
return -ENFILE;
}
@@ -226,13 +227,11 @@ int open ( const char *uri_string ) {
if ( ( rc = xfer_open_uri ( &file->xfer, uri_string ) ) != 0 )
goto err;
/* Request data */
if ( ( rc = xfer_request_all ( &file->xfer ) ) != 0 )
goto err;
/* Wait for open to succeed or fail */
while ( list_empty ( &file->data ) ) {
step();
if ( file->rc == 0 )
break;
if ( file->rc != -EINPROGRESS ) {
rc = file->rc;
goto err;
@@ -241,6 +240,7 @@ int open ( const char *uri_string ) {
/* Add to list of open files. List takes reference ownership. */
list_add ( &file->list, &posix_files );
DBG ( "POSIX opened %s as file %d\n", uri_string, fd );
return fd;
err: