- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/main/pjlib/src/pj/ioqueue_select.c
- Property svn:keywords set to Author
r1 r3 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 1 /* $Id$ 2 * 3 */ 22 4 /* 23 5 * sock_select.c … … 499 481 # if defined(PJ_WIN32) && PJ_WIN32 != 0 500 482 rc = pj_sock_recv(h->fd, h->rd_buf, &bytes_read, 0); 501 # elif defined(PJ_LINUX) && PJ_LINUX != 0 483 # elif (defined(PJ_LINUX) && PJ_LINUX != 0) || \ 484 (defined(PJ_SUNOS) && PJ_SUNOS != 0) 502 485 bytes_read = read(h->fd, h->rd_buf, bytes_read); 503 486 rc = (bytes_read >= 0) ? PJ_SUCCESS : pj_get_os_error(); … … 506 489 rc = (bytes_read >= 0) ? PJ_SUCCESS : -bytes_read; 507 490 # else 508 # error " Check this man!"491 # error "Implement read() for this platform!" 509 492 # endif 510 493 } … … 560 543 PJ_IOQUEUE_IS_CONNECT_OP(h->op)); 561 544 562 #if PJ_HAS_TCP545 #if defined(PJ_HAS_TCP) && PJ_HAS_TCP!=0 563 546 if ((h->op & PJ_IOQUEUE_OP_CONNECT)) { 564 547 /* Completion of connect() operation */ 565 548 pj_ssize_t bytes_transfered; 566 549 567 #if defined(PJ_LINUX) || defined(PJ_LINUX_KERNEL) 550 #if (defined(PJ_LINUX) && PJ_LINUX!=0) || \ 551 (defined(PJ_LINUX_KERNEL) && PJ_LINUX_KERNEL!=0) 568 552 /* from connect(2): 569 553 * On Linux, use getsockopt to read the SO_ERROR option at … … 585 569 bytes_transfered = value; 586 570 } 587 #elif defined(PJ_WIN32) 571 #elif defined(PJ_WIN32) && PJ_WIN32!=0 588 572 bytes_transfered = 0; /* success */ 589 573 #else 590 # error "Got to check this one!" 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; 591 590 #endif 592 591
Note: See TracChangeset
for help on using the changeset viewer.