author | Marek Vasut <marek.vasut@gmail.com> | 2007-07-14 22:09:38 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-15 18:33:28 (UTC) |
commit | 9dacb2c97939fad573446c0858f6b536b3d7bf15 (patch) (unidiff) | |
tree | 6cb098508e6513f67d608278bf6f61a08fb6d158 | |
parent | 15fbd2a9189281ca84d89ad6a77261d0046add36 (diff) | |
download | opie-9dacb2c97939fad573446c0858f6b536b3d7bf15.zip opie-9dacb2c97939fad573446c0858f6b536b3d7bf15.tar.gz opie-9dacb2c97939fad573446c0858f6b536b3d7bf15.tar.bz2 |
obex receive fixes
-rw-r--r-- | core/obex/obexserver.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/core/obex/obexserver.cpp b/core/obex/obexserver.cpp index f1fb205..786e9f7 100644 --- a/core/obex/obexserver.cpp +++ b/core/obex/obexserver.cpp | |||
@@ -202,17 +202,28 @@ static void obex_conn_event (obex_t *handle, obex_object_t *object, | |||
202 | break; | 202 | break; |
203 | } | 203 | } |
204 | break; | 204 | break; |
205 | 205 | ||
206 | case OBEX_EV_REQ: | 206 | case OBEX_EV_REQ: |
207 | /* Comes when a server-request has been received. */ | 207 | /* Comes when a server-request has been received. */ |
208 | handle_request (handle, object, event, obex_cmd); | 208 | handle_request (handle, object, event, obex_cmd); |
209 | break; | 209 | break; |
210 | 210 | case OBEX_EV_REQDONE: | |
211 | switch(obex_cmd) { | ||
212 | case OBEX_CMD_PUT: | ||
213 | case OBEX_CMD_CONNECT: | ||
214 | break; | ||
215 | case OBEX_CMD_DISCONNECT: | ||
216 | OBEX_TransportDisconnect(handle); | ||
217 | break; | ||
218 | default: | ||
219 | break; | ||
220 | } | ||
221 | break; | ||
211 | case OBEX_EV_LINKERR: | 222 | case OBEX_EV_LINKERR: |
212 | break; | 223 | break; |
213 | } | 224 | } |
214 | } | 225 | } |
215 | 226 | ||
216 | /** | 227 | /** |
217 | * Function handles OBEX event | 228 | * Function handles OBEX event |
218 | * @param handle OBEX connection handle | 229 | * @param handle OBEX connection handle |
@@ -419,30 +430,22 @@ bool ObexServer::start(RunMode runmode, Communication comm) | |||
419 | 430 | ||
420 | // We set the close on exec flag. | 431 | // We set the close on exec flag. |
421 | // Closing of fd[1] indicates that the execvp succeeded! | 432 | // Closing of fd[1] indicates that the execvp succeeded! |
422 | if ( fd[ 1 ] ) | 433 | if ( fd[ 1 ] ) |
423 | fcntl( fd[ 1 ], F_SETFD, FD_CLOEXEC ); | 434 | fcntl( fd[ 1 ], F_SETFD, FD_CLOEXEC ); |
424 | 435 | ||
425 | if (initObex() == 0) { | 436 | if (initObex() == 0) { |
426 | do { | 437 | do { |
427 | int result; //Connection result | ||
428 | if ( fd[ 1 ] ) { | 438 | if ( fd[ 1 ] ) { |
429 | ::close(fd[1]); | 439 | ::close(fd[1]); |
430 | fd[1] = 0; | 440 | fd[1] = 0; |
431 | } | 441 | } |
432 | if ((result = OBEX_HandleInput(m_obex, 60)) < 0) { | 442 | if (OBEX_HandleInput(m_obex, 10) < 0) |
433 | if (errno != ECONNRESET) { | ||
434 | printf("OBEX_HandleInput error %d\n", errno); | ||
435 | fflush(stdout); | ||
436 | _exit(-1); | ||
437 | } | ||
438 | else | ||
439 | _exit(0); | 443 | _exit(0); |
440 | } | ||
441 | } while(1); | 444 | } while(1); |
442 | } | 445 | } |
443 | char resultByte = 1; | 446 | char resultByte = 1; |
444 | if ( fd[ 1 ] ) | 447 | if ( fd[ 1 ] ) |
445 | write( fd[ 1 ], &resultByte, 1 ); | 448 | write( fd[ 1 ], &resultByte, 1 ); |
446 | _exit( -1 ); | 449 | _exit( -1 ); |
447 | } | 450 | } |
448 | else if ( -1 == pid_ ) | 451 | else if ( -1 == pid_ ) |