Changeset 862 for trunk/server/lib/tsocket/tsocket_bsd.c
- Timestamp:
- May 13, 2014, 11:39:04 AM (11 years ago)
- Location:
- trunk/server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 860
- Property svn:mergeinfo changed
-
trunk/server/lib/tsocket/tsocket_bsd.c
r745 r862 655 655 void *event_ptr; 656 656 struct tevent_fd *fde; 657 bool optimize_recvfrom; 657 658 658 659 void *readable_private; … … 661 662 void (*writeable_handler)(void *private_data); 662 663 }; 664 665 bool tdgram_bsd_optimize_recvfrom(struct tdgram_context *dgram, 666 bool on) 667 { 668 struct tdgram_bsd *bsds = 669 talloc_get_type(_tdgram_context_data(dgram), 670 struct tdgram_bsd); 671 bool old; 672 673 if (bsds == NULL) { 674 /* not a bsd socket */ 675 return false; 676 } 677 678 old = bsds->optimize_recvfrom; 679 bsds->optimize_recvfrom = on; 680 681 return old; 682 } 663 683 664 684 static void tdgram_bsd_fde_handler(struct tevent_context *ev, … … 838 858 } 839 859 860 840 861 /* 841 862 * this is a fast path, not waiting for the … … 843 864 * about 10%-20% performance in benchmark tests. 844 865 */ 845 tdgram_bsd_recvfrom_handler(req); 846 if (!tevent_req_is_in_progress(req)) { 847 goto post; 866 if (bsds->optimize_recvfrom) { 867 /* 868 * We only do the optimization on 869 * recvfrom if the caller asked for it. 870 * 871 * This is needed because in most cases 872 * we preferr to flush send buffers before 873 * receiving incoming requests. 874 */ 875 tdgram_bsd_recvfrom_handler(req); 876 if (!tevent_req_is_in_progress(req)) { 877 goto post; 878 } 848 879 } 849 880 … … 1401 1432 void *event_ptr; 1402 1433 struct tevent_fd *fde; 1434 bool optimize_readv; 1403 1435 1404 1436 void *readable_private; … … 1407 1439 void (*writeable_handler)(void *private_data); 1408 1440 }; 1441 1442 bool tstream_bsd_optimize_readv(struct tstream_context *stream, 1443 bool on) 1444 { 1445 struct tstream_bsd *bsds = 1446 talloc_get_type(_tstream_context_data(stream), 1447 struct tstream_bsd); 1448 bool old; 1449 1450 if (bsds == NULL) { 1451 /* not a bsd socket */ 1452 return false; 1453 } 1454 1455 old = bsds->optimize_readv; 1456 bsds->optimize_readv = on; 1457 1458 return old; 1459 } 1409 1460 1410 1461 static void tstream_bsd_fde_handler(struct tevent_context *ev, … … 1620 1671 * about 10%-20% performance in benchmark tests. 1621 1672 */ 1622 tstream_bsd_readv_handler(req); 1623 if (!tevent_req_is_in_progress(req)) { 1624 goto post; 1673 if (bsds->optimize_readv) { 1674 /* 1675 * We only do the optimization on 1676 * readv if the caller asked for it. 1677 * 1678 * This is needed because in most cases 1679 * we preferr to flush send buffers before 1680 * receiving incoming requests. 1681 */ 1682 tstream_bsd_readv_handler(req); 1683 if (!tevent_req_is_in_progress(req)) { 1684 goto post; 1685 } 1625 1686 } 1626 1687
Note:
See TracChangeset
for help on using the changeset viewer.