passenger 3.0.1 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of passenger might be problematic. Click here for more details.
- data/NEWS +20 -0
- data/build/common_library.rb +1 -0
- data/doc/cxxapi/Constants_8h_source.html +1 -1
- data/doc/cxxapi/IniFile_8h_source.html +527 -0
- data/doc/cxxapi/MessageChannel_8h_source.html +166 -158
- data/doc/cxxapi/ResourceLocator_8h_source.html +74 -73
- data/doc/cxxapi/classPassenger_1_1ResourceLocator-members.html +36 -0
- data/doc/cxxapi/classPassenger_1_1ResourceLocator.html +51 -0
- data/doc/cxxapi/inherit__graph__40.map +3 -0
- data/doc/cxxapi/inherit__graph__40.md5 +1 -0
- data/doc/cxxapi/inherit__graph__40.png +0 -0
- data/ext/common/AgentsStarter.hpp +10 -2
- data/ext/common/Constants.h +1 -1
- data/ext/common/IniFile.h +10 -2
- data/ext/common/MessageChannel.h +10 -2
- data/ext/common/ResourceLocator.h +2 -1
- data/ext/common/Utils.cpp +21 -2
- data/ext/common/Utils/StrIntUtils.cpp +2 -1
- data/ext/common/libboost_oxt/aggregate.cpp +10 -0
- data/ext/common/libpassenger_common/aggregate.cpp +15 -0
- data/ext/nginx/config +2 -0
- data/lib/phusion_passenger.rb +9 -1
- metadata +12 -4
@@ -602,164 +602,172 @@
|
|
602
602
|
<a name="l00577"></a>00577 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> ret;
|
603
603
|
<a name="l00578"></a>00578 <span class="keywordflow">try</span> {
|
604
604
|
<a name="l00579"></a>00579 ret = Passenger::readExact(fd, buf, size, &t);
|
605
|
-
<a name="l00580"></a>00580
|
606
|
-
<a name="l00581"></a>00581
|
607
|
-
<a name="l00582"></a>00582
|
608
|
-
<a name="l00583"></a>00583
|
609
|
-
<a name="l00584"></a>00584
|
610
|
-
<a name="l00585"></a>00585
|
611
|
-
<a name="l00586"></a>00586
|
612
|
-
<a name="l00587"></a>00587
|
613
|
-
<a name="l00588"></a>00588
|
614
|
-
<a name="l00589"></a>00589
|
615
|
-
<a name="l00590"></a>00590
|
616
|
-
<a name="l00591"></a>00591 <span class="
|
617
|
-
<a name="l00592"></a>00592 <span class="
|
618
|
-
<a name="l00593"></a>00593
|
619
|
-
<a name="l00594"></a>00594 <span class="
|
620
|
-
<a name="l00595"></a>00595
|
621
|
-
<a name="l00596"></a>00596
|
622
|
-
<a name="l00597"></a>00597
|
623
|
-
<a name="l00598"></a>00598
|
624
|
-
<a name="l00599"></a>00599 <span class="comment">
|
625
|
-
<a name="l00600"></a>00600 <span class="comment"> *
|
626
|
-
<a name="l00601"></a>00601 <span class="comment"> *
|
627
|
-
<a name="l00602"></a>00602 <span class="comment">
|
628
|
-
<a name="l00603"></a>00603 <span class="comment">
|
629
|
-
<a name="l00604"></a
|
630
|
-
<a name="l00605"></a>00605
|
631
|
-
<a name="l00606"></a>00606
|
632
|
-
<a name="l00607"></a>00607
|
633
|
-
<a name="l00608"></a>00608
|
634
|
-
<a name="l00609"></a>00609
|
635
|
-
<a name="l00610"></a>00610
|
636
|
-
<a name="l00611"></a>00611
|
637
|
-
<a name="l00612"></a>00612
|
638
|
-
<a name="l00613"></a>00613
|
639
|
-
<a name="l00614"></a>00614
|
640
|
-
<a name="l00615"></a>00615 <
|
641
|
-
<a name="l00616"></a>00616
|
642
|
-
<a name="l00617"></a>00617
|
643
|
-
<a name="l00618"></a>00618
|
644
|
-
<a name="l00619"></a>00619
|
645
|
-
<a name="l00620"></a>00620
|
646
|
-
<a name="l00621"></a>00621 <span class="preprocessor"
|
647
|
-
<a name="l00622"></a>00622 <span class="preprocessor"></span> <span class="
|
648
|
-
<a name="l00623"></a>00623
|
649
|
-
<a name="l00624"></a>00624
|
650
|
-
<a name="l00625"></a>00625
|
651
|
-
<a name="l00626"></a>00626
|
652
|
-
<a name="l00627"></a>00627
|
653
|
-
<a name="l00628"></a>00628
|
654
|
-
<a name="l00629"></a>00629
|
655
|
-
<a name="l00630"></a>00630
|
656
|
-
<a name="l00631"></a>00631
|
657
|
-
<a name="l00632"></a>00632
|
658
|
-
<a name="l00633"></a>00633
|
659
|
-
<a name="l00634"></a>00634
|
660
|
-
<a name="l00635"></a>00635
|
661
|
-
<a name="l00636"></a>00636
|
662
|
-
<a name="l00637"></a>00637 msg.
|
663
|
-
<a name="l00638"></a>00638
|
664
|
-
<a name="l00639"></a>00639
|
665
|
-
<a name="l00640"></a>00640
|
666
|
-
<a name="l00641"></a>00641
|
667
|
-
<a name="l00642"></a>00642
|
668
|
-
<a name="l00643"></a>00643
|
669
|
-
<a name="l00644"></a>00644
|
670
|
-
<a name="l00645"></a>00645
|
671
|
-
<a name="l00646"></a>00646
|
672
|
-
<a name="l00647"></a>00647
|
673
|
-
<a name="l00648"></a>00648
|
674
|
-
<a name="l00649"></a>00649
|
675
|
-
<a name="l00650"></a>00650 <span class="keywordflow">if</span> (
|
676
|
-
<a name="l00651"></a>00651
|
677
|
-
<a name="l00652"></a>00652
|
678
|
-
<a name="l00653"></a>00653
|
679
|
-
<a name="l00654"></a>00654
|
680
|
-
<a name="l00655"></a>00655
|
681
|
-
<a name="l00656"></a>00656
|
682
|
-
<a name="l00657"></a>00657
|
683
|
-
<a name="l00658"></a>00658
|
684
|
-
<a name="l00659"></a>00659
|
685
|
-
<a name="l00660"></a>00660
|
686
|
-
<a name="l00661"></a>00661 <span class="
|
687
|
-
<a name="l00662"></a>00662
|
688
|
-
<a name="l00663"></a>00663
|
689
|
-
<a name="l00664"></a>00664
|
690
|
-
<a name="l00665"></a>00665
|
691
|
-
<a name="l00666"></a>00666
|
692
|
-
<a name="l00667"></a>00667
|
693
|
-
<a name="l00668"></a>00668
|
694
|
-
<a name="l00669"></a>00669
|
695
|
-
<a name="l00670"></a>00670
|
696
|
-
<a name="l00671"></a>00671
|
697
|
-
<a name="l00672"></a>00672
|
698
|
-
<a name="l00673"></a>00673
|
699
|
-
<a name="l00674"></a>00674
|
700
|
-
<a name="l00675"></a>00675
|
701
|
-
<a name="l00676"></a>00676
|
702
|
-
<a name="l00677"></a>00677
|
703
|
-
<a name="l00678"></a>00678
|
704
|
-
<a name="l00679"></a>00679
|
705
|
-
<a name="l00680"></a>00680
|
706
|
-
<a name="l00681"></a>00681
|
707
|
-
<a name="l00682"></a>00682
|
708
|
-
<a name="l00683"></a>00683 <span class="comment">
|
709
|
-
<a name="l00684"></a>00684 <span class="comment">
|
710
|
-
<a name="l00685"></a
|
711
|
-
<a name="l00686"></a>00686
|
712
|
-
<a name="l00687"></a>00687
|
713
|
-
<a name="l00688"></a>00688
|
714
|
-
<a name="l00689"></a>00689
|
715
|
-
<a name="l00690"></a>00690
|
716
|
-
<a name="l00691"></a>00691
|
717
|
-
<a name="l00692"></a>00692
|
718
|
-
<a name="l00693"></a>00693
|
719
|
-
<a name="l00694"></a>00694
|
720
|
-
<a name="l00695"></a>00695
|
721
|
-
<a name="l00696"></a>00696
|
722
|
-
<a name="l00697"></a>00697
|
723
|
-
<a name="l00698"></a>00698
|
724
|
-
<a name="l00699"></a>00699
|
725
|
-
<a name="l00700"></a>00700
|
726
|
-
<a name="l00701"></a>00701 <span class="
|
727
|
-
<a name="l00702"></a>00702
|
728
|
-
<a name="l00703"></a>00703 <span class="
|
729
|
-
<a name="l00704"></a>00704
|
730
|
-
<a name="l00705"></a>00705
|
731
|
-
<a name="l00706"></a>00706
|
732
|
-
<a name="l00707"></a>00707
|
733
|
-
<a name="l00708"></a>00708 <span class="
|
734
|
-
<a name="l00709"></a>00709 <span class="
|
735
|
-
<a name="l00710"></a>00710
|
736
|
-
<a name="l00711"></a>00711 <span class="comment">
|
737
|
-
<a name="l00712"></a>00712 <span class="comment">
|
738
|
-
<a name="l00713"></a
|
739
|
-
<a name="l00714"></a>00714
|
740
|
-
<a name="l00715"></a>00715
|
741
|
-
<a name="l00716"></a>00716
|
742
|
-
<a name="l00717"></a>00717
|
743
|
-
<a name="l00718"></a>00718
|
744
|
-
<a name="l00719"></a>00719
|
745
|
-
<a name="l00720"></a>00720
|
746
|
-
<a name="l00721"></a>00721
|
747
|
-
<a name="l00722"></a>00722
|
748
|
-
<a name="l00723"></a>00723
|
749
|
-
<a name="l00724"></a>00724
|
750
|
-
<a name="l00725"></a>00725
|
751
|
-
<a name="l00726"></a>00726
|
752
|
-
<a name="l00727"></a>00727
|
753
|
-
<a name="l00728"></a>00728
|
754
|
-
<a name="l00729"></a>00729
|
755
|
-
<a name="l00730"></a>00730
|
756
|
-
<a name="l00731"></a>00731
|
757
|
-
<a name="l00732"></a>00732 <span class="
|
758
|
-
<a name="l00733"></a>00733
|
759
|
-
<a name="l00734"></a>00734
|
760
|
-
<a name="l00735"></a>00735
|
761
|
-
<a name="l00736"></a>00736
|
762
|
-
<a name="l00737"></a>00737
|
605
|
+
<a name="l00580"></a>00580 <span class="preprocessor"> #ifdef __NetBSD__</span>
|
606
|
+
<a name="l00581"></a>00581 <span class="preprocessor"></span> *timeout = llround((<span class="keywordtype">double</span>) t / 1000);
|
607
|
+
<a name="l00582"></a>00582 <span class="preprocessor"> #else</span>
|
608
|
+
<a name="l00583"></a>00583 <span class="preprocessor"></span> *timeout = llroundl((<span class="keywordtype">long</span> <span class="keywordtype">double</span>) t / 1000);
|
609
|
+
<a name="l00584"></a>00584 <span class="preprocessor"> #endif</span>
|
610
|
+
<a name="l00585"></a>00585 <span class="preprocessor"></span> <span class="keywordflow">return</span> ret == size;
|
611
|
+
<a name="l00586"></a>00586 } <span class="keywordflow">catch</span> (...) {
|
612
|
+
<a name="l00587"></a>00587 <span class="preprocessor"> #ifdef __NetBSD__</span>
|
613
|
+
<a name="l00588"></a>00588 <span class="preprocessor"></span> *timeout = llround((<span class="keywordtype">double</span>) t / 1000);
|
614
|
+
<a name="l00589"></a>00589 <span class="preprocessor"> #else</span>
|
615
|
+
<a name="l00590"></a>00590 <span class="preprocessor"></span> *timeout = llroundl((<span class="keywordtype">long</span> <span class="keywordtype">double</span>) t / 1000);
|
616
|
+
<a name="l00591"></a>00591 <span class="preprocessor"> #endif</span>
|
617
|
+
<a name="l00592"></a>00592 <span class="preprocessor"></span> <span class="keywordflow">throw</span>;
|
618
|
+
<a name="l00593"></a>00593 }
|
619
|
+
<a name="l00594"></a>00594 } <span class="keywordflow">else</span> {
|
620
|
+
<a name="l00595"></a>00595 <span class="keywordflow">return</span> Passenger::readExact(fd, buf, size) == size;
|
621
|
+
<a name="l00596"></a>00596 }
|
622
|
+
<a name="l00597"></a>00597 }
|
623
|
+
<a name="l00598"></a>00598 <span class="comment"></span>
|
624
|
+
<a name="l00599"></a>00599 <span class="comment"> /**</span>
|
625
|
+
<a name="l00600"></a>00600 <span class="comment"> * Receive a file descriptor, which had been passed over the underlying</span>
|
626
|
+
<a name="l00601"></a>00601 <span class="comment"> * file descriptor.</span>
|
627
|
+
<a name="l00602"></a>00602 <span class="comment"> *</span>
|
628
|
+
<a name="l00603"></a>00603 <span class="comment"> * @param negotiate See Ruby's MessageChannel#send_io method's comments.</span>
|
629
|
+
<a name="l00604"></a>00604 <span class="comment"> * @return The passed file descriptor.</span>
|
630
|
+
<a name="l00605"></a>00605 <span class="comment"> * @throws SystemException If something went wrong during the</span>
|
631
|
+
<a name="l00606"></a>00606 <span class="comment"> * receiving of a file descriptor. Perhaps the underlying</span>
|
632
|
+
<a name="l00607"></a>00607 <span class="comment"> * file descriptor isn't a Unix socket.</span>
|
633
|
+
<a name="l00608"></a>00608 <span class="comment"> * @throws IOException Whatever was received doesn't seem to be a</span>
|
634
|
+
<a name="l00609"></a>00609 <span class="comment"> * file descriptor.</span>
|
635
|
+
<a name="l00610"></a>00610 <span class="comment"> * @throws boost::thread_interrupted</span>
|
636
|
+
<a name="l00611"></a>00611 <span class="comment"> */</span>
|
637
|
+
<a name="l00612"></a><a class="code" href="classPassenger_1_1MessageChannel.html#a1a28ba9d078f38f2831673092ac9dcbc">00612</a> <span class="keywordtype">int</span> <a class="code" href="classPassenger_1_1MessageChannel.html#a1a28ba9d078f38f2831673092ac9dcbc" title="Receive a file descriptor, which had been passed over the underlying file descriptor...">readFileDescriptor</a>(<span class="keywordtype">bool</span> negotiate = <span class="keyword">true</span>) {
|
638
|
+
<a name="l00613"></a>00613 <span class="comment">// See message_channel.rb for more info about negotiation.</span>
|
639
|
+
<a name="l00614"></a>00614 <span class="keywordflow">if</span> (negotiate) {
|
640
|
+
<a name="l00615"></a>00615 <a class="code" href="classPassenger_1_1MessageChannel.html#a150f68bc47e060dcc6ca35bee047914d" title="Send an array message, which consists of the given elements, over the underlying...">write</a>(<span class="stringliteral">"pass IO"</span>, NULL);
|
641
|
+
<a name="l00616"></a>00616 }
|
642
|
+
<a name="l00617"></a>00617
|
643
|
+
<a name="l00618"></a>00618 <span class="keyword">struct </span>msghdr msg;
|
644
|
+
<a name="l00619"></a>00619 <span class="keyword">struct </span>iovec vec;
|
645
|
+
<a name="l00620"></a>00620 <span class="keywordtype">char</span> dummy[1];
|
646
|
+
<a name="l00621"></a>00621 <span class="preprocessor"> #if defined(__APPLE__) || defined(__SOLARIS__) || defined(__arm__)</span>
|
647
|
+
<a name="l00622"></a>00622 <span class="preprocessor"></span> <span class="comment">// File descriptor passing macros (CMSG_*) seem to be broken</span>
|
648
|
+
<a name="l00623"></a>00623 <span class="comment">// on 64-bit MacOS X. This structure works around the problem.</span>
|
649
|
+
<a name="l00624"></a>00624 <span class="keyword">struct </span>{
|
650
|
+
<a name="l00625"></a>00625 <span class="keyword">struct </span>cmsghdr header;
|
651
|
+
<a name="l00626"></a>00626 <span class="keywordtype">int</span> fd;
|
652
|
+
<a name="l00627"></a>00627 } control_data;
|
653
|
+
<a name="l00628"></a>00628 <span class="preprocessor"> #define EXPECTED_CMSG_LEN sizeof(control_data)</span>
|
654
|
+
<a name="l00629"></a>00629 <span class="preprocessor"></span><span class="preprocessor"> #else</span>
|
655
|
+
<a name="l00630"></a>00630 <span class="preprocessor"></span> <span class="keywordtype">char</span> control_data[CMSG_SPACE(<span class="keyword">sizeof</span>(<span class="keywordtype">int</span>))];
|
656
|
+
<a name="l00631"></a>00631 <span class="preprocessor"> #define EXPECTED_CMSG_LEN CMSG_LEN(sizeof(int))</span>
|
657
|
+
<a name="l00632"></a>00632 <span class="preprocessor"></span><span class="preprocessor"> #endif</span>
|
658
|
+
<a name="l00633"></a>00633 <span class="preprocessor"></span> <span class="keyword">struct </span>cmsghdr *control_header;
|
659
|
+
<a name="l00634"></a>00634 <span class="keywordtype">int</span> ret;
|
660
|
+
<a name="l00635"></a>00635
|
661
|
+
<a name="l00636"></a>00636 msg.msg_name = NULL;
|
662
|
+
<a name="l00637"></a>00637 msg.msg_namelen = 0;
|
663
|
+
<a name="l00638"></a>00638
|
664
|
+
<a name="l00639"></a>00639 dummy[0] = <span class="charliteral">'\0'</span>;
|
665
|
+
<a name="l00640"></a>00640 vec.iov_base = dummy;
|
666
|
+
<a name="l00641"></a>00641 vec.iov_len = <span class="keyword">sizeof</span>(dummy);
|
667
|
+
<a name="l00642"></a>00642 msg.msg_iov = &vec;
|
668
|
+
<a name="l00643"></a>00643 msg.msg_iovlen = 1;
|
669
|
+
<a name="l00644"></a>00644
|
670
|
+
<a name="l00645"></a>00645 msg.msg_control = (caddr_t) &control_data;
|
671
|
+
<a name="l00646"></a>00646 msg.msg_controllen = <span class="keyword">sizeof</span>(control_data);
|
672
|
+
<a name="l00647"></a>00647 msg.msg_flags = 0;
|
673
|
+
<a name="l00648"></a>00648
|
674
|
+
<a name="l00649"></a>00649 ret = syscalls::recvmsg(fd, &msg, 0);
|
675
|
+
<a name="l00650"></a>00650 <span class="keywordflow">if</span> (ret == -1) {
|
676
|
+
<a name="l00651"></a>00651 <span class="keywordflow">throw</span> <a class="code" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a>(<span class="stringliteral">"Cannot read file descriptor with recvmsg()"</span>, errno);
|
677
|
+
<a name="l00652"></a>00652 }
|
678
|
+
<a name="l00653"></a>00653
|
679
|
+
<a name="l00654"></a>00654 control_header = CMSG_FIRSTHDR(&msg);
|
680
|
+
<a name="l00655"></a>00655 <span class="keywordflow">if</span> (control_header == NULL) {
|
681
|
+
<a name="l00656"></a>00656 <span class="keywordflow">throw</span> <a class="code" href="classPassenger_1_1IOException.html" title="Represents an error that occured during an I/O operation.">IOException</a>(<span class="stringliteral">"No valid file descriptor received."</span>);
|
682
|
+
<a name="l00657"></a>00657 }
|
683
|
+
<a name="l00658"></a>00658 <span class="keywordflow">if</span> (control_header->cmsg_len != EXPECTED_CMSG_LEN
|
684
|
+
<a name="l00659"></a>00659 || control_header->cmsg_level != SOL_SOCKET
|
685
|
+
<a name="l00660"></a>00660 || control_header->cmsg_type != SCM_RIGHTS) {
|
686
|
+
<a name="l00661"></a>00661 <span class="keywordflow">throw</span> <a class="code" href="classPassenger_1_1IOException.html" title="Represents an error that occured during an I/O operation.">IOException</a>(<span class="stringliteral">"No valid file descriptor received."</span>);
|
687
|
+
<a name="l00662"></a>00662 }
|
688
|
+
<a name="l00663"></a>00663
|
689
|
+
<a name="l00664"></a>00664 <span class="preprocessor"> #if defined(__APPLE__) || defined(__SOLARIS__) || defined(__arm__)</span>
|
690
|
+
<a name="l00665"></a>00665 <span class="preprocessor"></span> <span class="keywordtype">int</span> fd = control_data.fd;
|
691
|
+
<a name="l00666"></a>00666 <span class="preprocessor"> #else</span>
|
692
|
+
<a name="l00667"></a>00667 <span class="preprocessor"></span> <span class="keywordtype">int</span> fd = *((<span class="keywordtype">int</span> *) CMSG_DATA(control_header));
|
693
|
+
<a name="l00668"></a>00668 <span class="preprocessor"> #endif</span>
|
694
|
+
<a name="l00669"></a>00669 <span class="preprocessor"></span>
|
695
|
+
<a name="l00670"></a>00670 <span class="keywordflow">if</span> (negotiate) {
|
696
|
+
<a name="l00671"></a>00671 <span class="keywordflow">try</span> {
|
697
|
+
<a name="l00672"></a>00672 <a class="code" href="classPassenger_1_1MessageChannel.html#a150f68bc47e060dcc6ca35bee047914d" title="Send an array message, which consists of the given elements, over the underlying...">write</a>(<span class="stringliteral">"got IO"</span>, NULL);
|
698
|
+
<a name="l00673"></a>00673 } <span class="keywordflow">catch</span> (...) {
|
699
|
+
<a name="l00674"></a>00674 this_thread::disable_syscall_interruption dsi;
|
700
|
+
<a name="l00675"></a>00675 <a class="code" href="classPassenger_1_1MessageChannel.html#a06309e208fc5e10642a2e9bbe0f351eb" title="Close the underlying file descriptor.">syscalls::close</a>(fd);
|
701
|
+
<a name="l00676"></a>00676 <span class="keywordflow">throw</span>;
|
702
|
+
<a name="l00677"></a>00677 }
|
703
|
+
<a name="l00678"></a>00678 }
|
704
|
+
<a name="l00679"></a>00679
|
705
|
+
<a name="l00680"></a>00680 <span class="keywordflow">return</span> fd;
|
706
|
+
<a name="l00681"></a>00681 }
|
707
|
+
<a name="l00682"></a>00682 <span class="comment"></span>
|
708
|
+
<a name="l00683"></a>00683 <span class="comment"> /**</span>
|
709
|
+
<a name="l00684"></a>00684 <span class="comment"> * Set the timeout value for reading data from this channel.</span>
|
710
|
+
<a name="l00685"></a>00685 <span class="comment"> * If no data can be read within the timeout period, then a</span>
|
711
|
+
<a name="l00686"></a>00686 <span class="comment"> * SystemException will be thrown by one of the read methods,</span>
|
712
|
+
<a name="l00687"></a>00687 <span class="comment"> * with error code EAGAIN or EWOULDBLOCK.</span>
|
713
|
+
<a name="l00688"></a>00688 <span class="comment"> *</span>
|
714
|
+
<a name="l00689"></a>00689 <span class="comment"> * @param msec The timeout, in milliseconds. If 0 is given,</span>
|
715
|
+
<a name="l00690"></a>00690 <span class="comment"> * there will be no timeout.</span>
|
716
|
+
<a name="l00691"></a>00691 <span class="comment"> * @throws SystemException Cannot set the timeout.</span>
|
717
|
+
<a name="l00692"></a>00692 <span class="comment"> */</span>
|
718
|
+
<a name="l00693"></a><a class="code" href="classPassenger_1_1MessageChannel.html#aeb69bffbbb148c9bc8662e20b416c4e2">00693</a> <span class="keywordtype">void</span> <a class="code" href="classPassenger_1_1MessageChannel.html#aeb69bffbbb148c9bc8662e20b416c4e2" title="Set the timeout value for reading data from this channel.">setReadTimeout</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> msec) {
|
719
|
+
<a name="l00694"></a>00694 <span class="comment">// See the comment for setWriteTimeout().</span>
|
720
|
+
<a name="l00695"></a>00695 <span class="keyword">struct </span>timeval tv;
|
721
|
+
<a name="l00696"></a>00696 <span class="keywordtype">int</span> ret;
|
722
|
+
<a name="l00697"></a>00697
|
723
|
+
<a name="l00698"></a>00698 tv.tv_sec = msec / 1000;
|
724
|
+
<a name="l00699"></a>00699 tv.tv_usec = msec % 1000 * 1000;
|
725
|
+
<a name="l00700"></a>00700 ret = syscalls::setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO,
|
726
|
+
<a name="l00701"></a>00701 &tv, <span class="keyword">sizeof</span>(tv));
|
727
|
+
<a name="l00702"></a>00702 <span class="preprocessor"> #ifndef __SOLARIS__</span>
|
728
|
+
<a name="l00703"></a>00703 <span class="preprocessor"></span> <span class="comment">// SO_RCVTIMEO is unimplemented and returns an error on Solaris</span>
|
729
|
+
<a name="l00704"></a>00704 <span class="comment">// 9 and 10 SPARC. Seems to work okay without it.</span>
|
730
|
+
<a name="l00705"></a>00705 <span class="keywordflow">if</span> (ret == -1) {
|
731
|
+
<a name="l00706"></a>00706 <span class="keywordflow">throw</span> <a class="code" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a>(<span class="stringliteral">"Cannot set read timeout for socket"</span>, errno);
|
732
|
+
<a name="l00707"></a>00707 }
|
733
|
+
<a name="l00708"></a>00708 <span class="preprocessor"> #endif</span>
|
734
|
+
<a name="l00709"></a>00709 <span class="preprocessor"></span> }
|
735
|
+
<a name="l00710"></a>00710 <span class="comment"></span>
|
736
|
+
<a name="l00711"></a>00711 <span class="comment"> /**</span>
|
737
|
+
<a name="l00712"></a>00712 <span class="comment"> * Set the timeout value for writing data to this channel.</span>
|
738
|
+
<a name="l00713"></a>00713 <span class="comment"> * If no data can be written within the timeout period, then a</span>
|
739
|
+
<a name="l00714"></a>00714 <span class="comment"> * SystemException will be thrown, with error code EAGAIN or</span>
|
740
|
+
<a name="l00715"></a>00715 <span class="comment"> * EWOULDBLOCK.</span>
|
741
|
+
<a name="l00716"></a>00716 <span class="comment"> *</span>
|
742
|
+
<a name="l00717"></a>00717 <span class="comment"> * @param msec The timeout, in milliseconds. If 0 is given,</span>
|
743
|
+
<a name="l00718"></a>00718 <span class="comment"> * there will be no timeout.</span>
|
744
|
+
<a name="l00719"></a>00719 <span class="comment"> * @throws SystemException Cannot set the timeout.</span>
|
745
|
+
<a name="l00720"></a>00720 <span class="comment"> */</span>
|
746
|
+
<a name="l00721"></a><a class="code" href="classPassenger_1_1MessageChannel.html#a77c5d7c47f387cf43992ebeb14e3c6c7">00721</a> <span class="keywordtype">void</span> <a class="code" href="classPassenger_1_1MessageChannel.html#a77c5d7c47f387cf43992ebeb14e3c6c7" title="Set the timeout value for writing data to this channel.">setWriteTimeout</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> msec) {
|
747
|
+
<a name="l00722"></a>00722 <span class="comment">// People say that SO_RCVTIMEO/SO_SNDTIMEO are unreliable and</span>
|
748
|
+
<a name="l00723"></a>00723 <span class="comment">// not well-implemented on all platforms.</span>
|
749
|
+
<a name="l00724"></a>00724 <span class="comment">// http://www.developerweb.net/forum/archive/index.php/t-3439.html</span>
|
750
|
+
<a name="l00725"></a>00725 <span class="comment">// That's why we use APR's timeout facilities as well (see Hooks.cpp).</span>
|
751
|
+
<a name="l00726"></a>00726 <span class="keyword">struct </span>timeval tv;
|
752
|
+
<a name="l00727"></a>00727 <span class="keywordtype">int</span> ret;
|
753
|
+
<a name="l00728"></a>00728
|
754
|
+
<a name="l00729"></a>00729 tv.tv_sec = msec / 1000;
|
755
|
+
<a name="l00730"></a>00730 tv.tv_usec = msec % 1000 * 1000;
|
756
|
+
<a name="l00731"></a>00731 ret = syscalls::setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO,
|
757
|
+
<a name="l00732"></a>00732 &tv, <span class="keyword">sizeof</span>(tv));
|
758
|
+
<a name="l00733"></a>00733 <span class="preprocessor"> #ifndef __SOLARIS__</span>
|
759
|
+
<a name="l00734"></a>00734 <span class="preprocessor"></span> <span class="comment">// SO_SNDTIMEO is unimplemented and returns an error on Solaris</span>
|
760
|
+
<a name="l00735"></a>00735 <span class="comment">// 9 and 10 SPARC. Seems to work okay without it.</span>
|
761
|
+
<a name="l00736"></a>00736 <span class="keywordflow">if</span> (ret == -1) {
|
762
|
+
<a name="l00737"></a>00737 <span class="keywordflow">throw</span> <a class="code" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a>(<span class="stringliteral">"Cannot set read timeout for socket"</span>, errno);
|
763
|
+
<a name="l00738"></a>00738 }
|
764
|
+
<a name="l00739"></a>00739 <span class="preprocessor"> #endif</span>
|
765
|
+
<a name="l00740"></a>00740 <span class="preprocessor"></span> }
|
766
|
+
<a name="l00741"></a>00741 };
|
767
|
+
<a name="l00742"></a>00742
|
768
|
+
<a name="l00743"></a>00743 } <span class="comment">// namespace Passenger</span>
|
769
|
+
<a name="l00744"></a>00744
|
770
|
+
<a name="l00745"></a>00745 <span class="preprocessor">#endif </span><span class="comment">/* _PASSENGER_MESSAGE_CHANNEL_H_ */</span>
|
763
771
|
</pre></div></div>
|
764
772
|
<hr size="1"/><address style="text-align: right;"><small>Generated by
|
765
773
|
<a href="http://www.doxygen.org/index.html">
|
@@ -83,80 +83,81 @@
|
|
83
83
|
<a name="l00058"></a>00058
|
84
84
|
<a name="l00059"></a>00059 <span class="keyword">public</span>:
|
85
85
|
<a name="l00060"></a>00060 <a class="code" href="classPassenger_1_1ResourceLocator.html" title="Locates various Phusion Passenger resources on the filesystem.">ResourceLocator</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &rootOrFile) {
|
86
|
-
<a name="l00061"></a>00061 <
|
87
|
-
<a name="l00062"></a>00062
|
88
|
-
<a name="l00063"></a>00063 <span class="keywordtype">
|
89
|
-
<a name="l00064"></a>00064
|
90
|
-
<a name="l00065"></a>00065
|
91
|
-
<a name="l00066"></a>00066
|
92
|
-
<a name="l00067"></a>00067
|
93
|
-
<a name="l00068"></a>00068
|
94
|
-
<a name="l00069"></a>00069
|
95
|
-
<a name="l00070"></a>00070
|
96
|
-
<a name="l00071"></a>00071
|
97
|
-
<a name="l00072"></a>00072
|
98
|
-
<a name="l00073"></a>00073
|
99
|
-
<a name="l00074"></a>00074
|
100
|
-
<a name="l00075"></a>00075
|
101
|
-
<a name="l00076"></a>00076
|
102
|
-
<a name="l00077"></a>00077
|
103
|
-
<a name="l00078"></a>00078
|
104
|
-
<a name="l00079"></a>00079
|
105
|
-
<a name="l00080"></a>00080
|
106
|
-
<a name="l00081"></a>00081
|
107
|
-
<a name="l00082"></a>00082
|
108
|
-
<a name="l00083"></a>00083
|
109
|
-
<a name="l00084"></a>00084
|
110
|
-
<a name="l00085"></a>00085
|
111
|
-
<a name="l00086"></a>00086
|
112
|
-
<a name="l00087"></a>00087
|
113
|
-
<a name="l00088"></a>00088
|
114
|
-
<a name="l00089"></a>00089
|
115
|
-
<a name="l00090"></a>00090
|
116
|
-
<a name="l00091"></a>00091
|
117
|
-
<a name="l00092"></a>00092
|
118
|
-
<a name="l00093"></a>00093
|
119
|
-
<a name="l00094"></a>00094
|
120
|
-
<a name="l00095"></a>00095
|
121
|
-
<a name="l00096"></a>00096
|
122
|
-
<a name="l00097"></a>00097
|
123
|
-
<a name="l00098"></a>00098
|
124
|
-
<a name="l00099"></a>00099
|
125
|
-
<a name="l00100"></a>00100
|
126
|
-
<a name="l00101"></a>00101
|
127
|
-
<a name="l00102"></a>00102
|
128
|
-
<a name="l00103"></a>00103
|
129
|
-
<a name="l00104"></a>00104
|
130
|
-
<a name="l00105"></a>00105
|
131
|
-
<a name="l00106"></a>00106
|
132
|
-
<a name="l00107"></a>00107
|
133
|
-
<a name="l00108"></a>00108
|
134
|
-
<a name="l00109"></a>00109
|
135
|
-
<a name="l00110"></a>00110
|
136
|
-
<a name="l00111"></a>00111
|
137
|
-
<a name="l00112"></a>00112
|
138
|
-
<a name="l00113"></a>00113
|
139
|
-
<a name="l00114"></a>00114
|
140
|
-
<a name="l00115"></a>00115
|
141
|
-
<a name="l00116"></a>00116
|
142
|
-
<a name="l00117"></a>00117
|
143
|
-
<a name="l00118"></a>00118 <span class="
|
144
|
-
<a name="l00119"></a>00119
|
145
|
-
<a name="l00120"></a>00120
|
146
|
-
<a name="l00121"></a>00121
|
147
|
-
<a name="l00122"></a>00122
|
148
|
-
<a name="l00123"></a>00123
|
149
|
-
<a name="l00124"></a>00124
|
150
|
-
<a name="l00125"></a>00125
|
151
|
-
<a name="l00126"></a>00126
|
152
|
-
<a name="l00127"></a>00127
|
153
|
-
<a name="l00128"></a>00128
|
154
|
-
<a name="l00129"></a>00129
|
155
|
-
<a name="l00130"></a>00130
|
86
|
+
<a name="l00061"></a>00061 <a class="code" href="namespacePassenger.html#a14174b712df6046cb823cde43d7ef07d" title="Enumeration which indicates what kind of file a file is.">FileType</a> rootOrFileType = <a class="code" href="group__Support.html#ga15298b031377d3ecb80295bd5b1a8180" title="Check whether &#39;filename&#39; exists and what kind of file it is.">getFileType</a>(rootOrFile);
|
87
|
+
<a name="l00062"></a>00062 <span class="keywordflow">if</span> (rootOrFileType == <a class="code" href="namespacePassenger.html#a14174b712df6046cb823cde43d7ef07dabb09dbba1071b4770913363db2462eee" title="A directory.">FT_DIRECTORY</a> || rootOrFileType == <a class="code" href="namespacePassenger.html#a14174b712df6046cb823cde43d7ef07da9fc66834fe96c52799397496b8df8486" title="The file doesn&#39;t exist.">FT_NONEXISTANT</a>) {
|
88
|
+
<a name="l00063"></a>00063 <span class="keywordtype">string</span> root = rootOrFile;
|
89
|
+
<a name="l00064"></a>00064 <span class="keywordtype">bool</span> nativelyPackaged = !<a class="code" href="group__Support.html#ga2a62e38a72c6c65992e3361f6d80c7ef" title="Check whether the specified file exists.">fileExists</a>(root + <span class="stringliteral">"/Rakefile"</span>) ||
|
90
|
+
<a name="l00065"></a>00065 !<a class="code" href="group__Support.html#ga2a62e38a72c6c65992e3361f6d80c7ef" title="Check whether the specified file exists.">fileExists</a>(root + <span class="stringliteral">"/DEVELOPERS.TXT"</span>);
|
91
|
+
<a name="l00066"></a>00066
|
92
|
+
<a name="l00067"></a>00067 <span class="keywordflow">if</span> (nativelyPackaged) {
|
93
|
+
<a name="l00068"></a>00068 agentsDir = <span class="stringliteral">"/usr/lib/phusion-passenger/agents"</span>;
|
94
|
+
<a name="l00069"></a>00069 helperScriptsDir = <span class="stringliteral">"/usr/share/phusion-passenger/helper-scripts"</span>;
|
95
|
+
<a name="l00070"></a>00070 resourcesDir = <span class="stringliteral">"/usr/share/phusion-passenger"</span>;
|
96
|
+
<a name="l00071"></a>00071 docDir = <span class="stringliteral">"/usr/share/doc/phusion-passenger"</span>;
|
97
|
+
<a name="l00072"></a>00072 rubyLibDir = <span class="stringliteral">""</span>;
|
98
|
+
<a name="l00073"></a>00073 compilableSourceDir = <span class="stringliteral">"/usr/share/phusion-passenger/compilable-source"</span>;
|
99
|
+
<a name="l00074"></a>00074 apache2Module = <span class="stringliteral">"/usr/lib/apache2/modules/mod_passenger.so"</span>;
|
100
|
+
<a name="l00075"></a>00075 } <span class="keywordflow">else</span> {
|
101
|
+
<a name="l00076"></a>00076 agentsDir = root + <span class="stringliteral">"/agents"</span>;
|
102
|
+
<a name="l00077"></a>00077 helperScriptsDir = root + <span class="stringliteral">"/helper-scripts"</span>;
|
103
|
+
<a name="l00078"></a>00078 resourcesDir = root + <span class="stringliteral">"/resources"</span>;
|
104
|
+
<a name="l00079"></a>00079 docDir = root + <span class="stringliteral">"/doc"</span>;
|
105
|
+
<a name="l00080"></a>00080 rubyLibDir = root + <span class="stringliteral">"/lib"</span>;
|
106
|
+
<a name="l00081"></a>00081 compilableSourceDir = root;
|
107
|
+
<a name="l00082"></a>00082 apache2Module = root + <span class="stringliteral">"ext/apache2/mod_passenger.so"</span>;
|
108
|
+
<a name="l00083"></a>00083 }
|
109
|
+
<a name="l00084"></a>00084
|
110
|
+
<a name="l00085"></a>00085 } <span class="keywordflow">else</span> {
|
111
|
+
<a name="l00086"></a>00086 <span class="keywordtype">string</span> file = rootOrFile;
|
112
|
+
<a name="l00087"></a>00087 IniFileSectionPtr options = IniFile(file).section(<span class="stringliteral">"locations"</span>);
|
113
|
+
<a name="l00088"></a>00088 agentsDir = getOption(file, options, <span class="stringliteral">"agents"</span>);
|
114
|
+
<a name="l00089"></a>00089 helperScriptsDir = getOption(file, options, <span class="stringliteral">"helper_scripts"</span>);
|
115
|
+
<a name="l00090"></a>00090 resourcesDir = getOption(file, options, <span class="stringliteral">"resources"</span>);
|
116
|
+
<a name="l00091"></a>00091 docDir = getOption(file, options, <span class="stringliteral">"doc"</span>);
|
117
|
+
<a name="l00092"></a>00092 rubyLibDir = getOption(file, options, <span class="stringliteral">"rubylib"</span>);
|
118
|
+
<a name="l00093"></a>00093 compilableSourceDir = getOption(file, options, <span class="stringliteral">"compilable_source"</span>);
|
119
|
+
<a name="l00094"></a>00094 apache2Module = getOption(file, options, <span class="stringliteral">"apache2_module"</span>);
|
120
|
+
<a name="l00095"></a>00095 }
|
121
|
+
<a name="l00096"></a>00096 }
|
122
|
+
<a name="l00097"></a>00097
|
123
|
+
<a name="l00098"></a>00098 <span class="keywordtype">string</span> getAgentsDir()<span class="keyword"> const </span>{
|
124
|
+
<a name="l00099"></a>00099 <span class="keywordflow">return</span> agentsDir;
|
125
|
+
<a name="l00100"></a>00100 }
|
126
|
+
<a name="l00101"></a>00101
|
127
|
+
<a name="l00102"></a>00102 <span class="keywordtype">string</span> getHelperScriptsDir()<span class="keyword"> const </span>{
|
128
|
+
<a name="l00103"></a>00103 <span class="keywordflow">return</span> helperScriptsDir;
|
129
|
+
<a name="l00104"></a>00104 }
|
130
|
+
<a name="l00105"></a>00105
|
131
|
+
<a name="l00106"></a>00106 <span class="keywordtype">string</span> getSpawnServerFilename()<span class="keyword"> const </span>{
|
132
|
+
<a name="l00107"></a>00107 <span class="keywordflow">return</span> getHelperScriptsDir() + <span class="stringliteral">"/passenger-spawn-server"</span>;
|
133
|
+
<a name="l00108"></a>00108 }
|
134
|
+
<a name="l00109"></a>00109
|
135
|
+
<a name="l00110"></a>00110 <span class="keywordtype">string</span> getResourcesDir()<span class="keyword"> const </span>{
|
136
|
+
<a name="l00111"></a>00111 <span class="keywordflow">return</span> resourcesDir;
|
137
|
+
<a name="l00112"></a>00112 }
|
138
|
+
<a name="l00113"></a>00113
|
139
|
+
<a name="l00114"></a>00114 <span class="keywordtype">string</span> getDocDir()<span class="keyword"> const </span>{
|
140
|
+
<a name="l00115"></a>00115 <span class="keywordflow">return</span> docDir;
|
141
|
+
<a name="l00116"></a>00116 }
|
142
|
+
<a name="l00117"></a>00117
|
143
|
+
<a name="l00118"></a>00118 <span class="comment">// Can be empty.</span>
|
144
|
+
<a name="l00119"></a>00119 <span class="keywordtype">string</span> getRubyLibDir()<span class="keyword"> const </span>{
|
145
|
+
<a name="l00120"></a>00120 <span class="keywordflow">return</span> rubyLibDir;
|
146
|
+
<a name="l00121"></a>00121 }
|
147
|
+
<a name="l00122"></a>00122
|
148
|
+
<a name="l00123"></a>00123 <span class="keywordtype">string</span> getCompilableSourceDir()<span class="keyword"> const </span>{
|
149
|
+
<a name="l00124"></a>00124 <span class="keywordflow">return</span> compilableSourceDir;
|
150
|
+
<a name="l00125"></a>00125 }
|
151
|
+
<a name="l00126"></a>00126
|
152
|
+
<a name="l00127"></a>00127 <span class="keywordtype">string</span> getApache2ModuleFilename()<span class="keyword"> const </span>{
|
153
|
+
<a name="l00128"></a>00128 <span class="keywordflow">return</span> apache2Module;
|
154
|
+
<a name="l00129"></a>00129 }
|
155
|
+
<a name="l00130"></a>00130 };
|
156
156
|
<a name="l00131"></a>00131
|
157
|
-
<a name="l00132"></a>00132
|
158
|
-
<a name="l00133"></a>00133
|
159
|
-
<a name="l00134"></a>00134
|
157
|
+
<a name="l00132"></a>00132
|
158
|
+
<a name="l00133"></a>00133 }
|
159
|
+
<a name="l00134"></a>00134
|
160
|
+
<a name="l00135"></a>00135 <span class="preprocessor">#endif </span><span class="comment">/* _PASSENGER_RESOURCE_LOCATOR_H_ */</span>
|
160
161
|
</pre></div></div>
|
161
162
|
<hr size="1"/><address style="text-align: right;"><small>Generated by
|
162
163
|
<a href="http://www.doxygen.org/index.html">
|