- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/main/pjlib/src/pj/ioqueue_select.c
- Property svn:keywords deleted
r3 r1 1 /* $Id$ 2 * 3 */ 1 /* $Header: /pjproject-0.3/pjlib/src/pj/ioqueue_select.c 15 10/29/05 10:27p Bennylp $ */ 2 /* $Log: /pjproject-0.3/pjlib/src/pj/ioqueue_select.c $ 3 * 4 * 15 10/29/05 10:27p Bennylp 5 * Fixed misc warnings. 6 * 7 * 14 10/29/05 11:31a Bennylp 8 * Changed accept and lock. 9 * 10 * 13 10/14/05 12:26a Bennylp 11 * Finished error code framework, some fixes in ioqueue, etc. Pretty 12 * major. 13 * 14 * 12 9/21/05 1:39p Bennylp 15 * Periodic checkin for backup. 16 * 17 * 11 9/17/05 10:37a Bennylp 18 * Major reorganization towards version 0.3. 19 * 20 */ 21 4 22 /* 5 23 * sock_select.c … … 481 499 # if defined(PJ_WIN32) && PJ_WIN32 != 0 482 500 rc = pj_sock_recv(h->fd, h->rd_buf, &bytes_read, 0); 483 # elif (defined(PJ_LINUX) && PJ_LINUX != 0) || \ 484 (defined(PJ_SUNOS) && PJ_SUNOS != 0) 501 # elif defined(PJ_LINUX) && PJ_LINUX != 0 485 502 bytes_read = read(h->fd, h->rd_buf, bytes_read); 486 503 rc = (bytes_read >= 0) ? PJ_SUCCESS : pj_get_os_error(); … … 489 506 rc = (bytes_read >= 0) ? PJ_SUCCESS : -bytes_read; 490 507 # else 491 # error " Implement read() for this platform!"508 # error "Check this man!" 492 509 # endif 493 510 } … … 543 560 PJ_IOQUEUE_IS_CONNECT_OP(h->op)); 544 561 545 #if defined(PJ_HAS_TCP) && PJ_HAS_TCP!=0562 #if PJ_HAS_TCP 546 563 if ((h->op & PJ_IOQUEUE_OP_CONNECT)) { 547 564 /* Completion of connect() operation */ 548 565 pj_ssize_t bytes_transfered; 549 566 550 #if (defined(PJ_LINUX) && PJ_LINUX!=0) || \ 551 (defined(PJ_LINUX_KERNEL) && PJ_LINUX_KERNEL!=0) 567 #if defined(PJ_LINUX) || defined(PJ_LINUX_KERNEL) 552 568 /* from connect(2): 553 569 * On Linux, use getsockopt to read the SO_ERROR option at … … 569 585 bytes_transfered = value; 570 586 } 571 #elif defined(PJ_WIN32) && PJ_WIN32!=0587 #elif defined(PJ_WIN32) 572 588 bytes_transfered = 0; /* success */ 573 589 #else 574 /* Excellent information in D.J. Bernstein page: 575 * http://cr.yp.to/docs/connect.html 576 * 577 * Seems like the most portable way of detecting connect() 578 * failure is to call getpeername(). If socket is connected, 579 * getpeername() will return 0. If the socket is not connected, 580 * it will return ENOTCONN, and read(fd, &ch, 1) will produce 581 * the right errno through error slippage. This is a combination 582 * of suggestions from Douglas C. Schmidt and Ken Keys. 583 */ 584 int gp_rc; 585 struct sockaddr_in addr; 586 socklen_t addrlen = sizeof(addr); 587 588 gp_rc = getpeername(h->fd, (struct sockaddr*)&addr, &addrlen); 589 bytes_transfered = gp_rc; 590 # error "Got to check this one!" 590 591 #endif 591 592
Note: See TracChangeset
for help on using the changeset viewer.