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 | 25 |
1 files changed, 14 insertions, 11 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 | |||
@@ -198,25 +198,36 @@ static void obex_conn_event (obex_t *handle, obex_object_t *object, | |||
198 | break; | 198 | break; |
199 | default: | 199 | default: |
200 | OBEX_ObjectSetRsp (object, OBEX_RSP_NOT_IMPLEMENTED, | 200 | OBEX_ObjectSetRsp (object, OBEX_RSP_NOT_IMPLEMENTED, |
201 | OBEX_RSP_NOT_IMPLEMENTED); | 201 | OBEX_RSP_NOT_IMPLEMENTED); |
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 |
219 | * @param object OBEX object itself | 230 | * @param object OBEX object itself |
220 | * @param mode | 231 | * @param mode |
221 | * @param event event code | 232 | * @param event event code |
222 | * @param obex_cmd OBEX command itself | 233 | * @param obex_cmd OBEX command itself |
@@ -415,38 +426,30 @@ bool ObexServer::start(RunMode runmode, Communication comm) | |||
415 | sigaddset( &( act.sa_mask ), SIGPIPE ); | 426 | sigaddset( &( act.sa_mask ), SIGPIPE ); |
416 | act.sa_handler = SIG_DFL; | 427 | act.sa_handler = SIG_DFL; |
417 | act.sa_flags = 0; | 428 | act.sa_flags = 0; |
418 | sigaction( SIGPIPE, &act, 0L ); | 429 | sigaction( SIGPIPE, &act, 0L ); |
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) { | 443 | _exit(0); |
434 | printf("OBEX_HandleInput error %d\n", errno); | ||
435 | fflush(stdout); | ||
436 | _exit(-1); | ||
437 | } | ||
438 | else | ||
439 | _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_ ) |
449 | { | 452 | { |
450 | // forking failed | 453 | // forking failed |
451 | 454 | ||
452 | runs = false; | 455 | runs = false; |