Ticket #9: 600_win32_inet.patch
| File 600_win32_inet.patch, 1.6 KB (added by hsattler, 18 months ago) |
|---|
-
lib/obex_transport.c
old new 361 361 /* 362 362 * does fragmented write 363 363 */ 364 static int do_write(int fd, buf_t *msg, int mtu) 364 static int do_write(int fd, buf_t *msg, int mtu, 365 ssize_t (*write_func)(int, const void *, size_t)) 365 366 { 366 367 int actual = -1; 367 368 int size; … … 374 375 size = msg->data_size; 375 376 DEBUG(1, "sending %d bytes\n", size); 376 377 377 actual = write (fd, msg->data, size);378 actual = write_func(fd, msg->data, size); 378 379 if (actual <= 0) 379 380 return actual; 380 381 … … 384 385 return actual; 385 386 } 386 387 388 static ssize_t send_wrap (int s, const void *buf, size_t len) 389 { 390 return send(s,buf,len,0); 391 } 392 387 393 /* 388 394 * Function obex_transport_write () 389 395 * … … 404 410 case OBEX_TRANS_BLUETOOTH: 405 411 #endif /*HAVE_BLUETOOTH*/ 406 412 case OBEX_TRANS_INET: 407 actual = do_write(self->fd, msg, self->trans.mtu );413 actual = do_write(self->fd, msg, self->trans.mtu, send_wrap); 408 414 break; 409 415 case OBEX_TRANS_FD: 410 actual = do_write(self->writefd, msg, self->trans.mtu );416 actual = do_write(self->writefd, msg, self->trans.mtu, write); 411 417 break; 412 418 #ifdef HAVE_USB 413 419 case OBEX_TRANS_USB: … … 454 460 case OBEX_TRANS_BLUETOOTH: 455 461 #endif /*HAVE_BLUETOOTH*/ 456 462 case OBEX_TRANS_INET: 463 actual = recv(self->fd, buf_reserve_end(msg, max), max, 0); 464 if (actual > 0) 465 buf_remove_end(msg, max - actual); 466 break; 457 467 case OBEX_TRANS_FD: 458 468 actual = read(self->fd, buf_reserve_end(msg, max), max); 459 469 if (actual > 0)
