… | |
… | |
832 | =item $handle->on_drain ($cb) |
832 | =item $handle->on_drain ($cb) |
833 | |
833 | |
834 | Sets the C<on_drain> callback or clears it (see the description of |
834 | Sets the C<on_drain> callback or clears it (see the description of |
835 | C<on_drain> in the constructor). |
835 | C<on_drain> in the constructor). |
836 | |
836 | |
|
|
837 | This method may invoke callbacks (and therefore the handle might be |
|
|
838 | destroyed after it returns). |
|
|
839 | |
837 | =cut |
840 | =cut |
838 | |
841 | |
839 | sub on_drain { |
842 | sub on_drain { |
840 | my ($self, $cb) = @_; |
843 | my ($self, $cb) = @_; |
841 | |
844 | |
… | |
… | |
848 | =item $handle->push_write ($data) |
851 | =item $handle->push_write ($data) |
849 | |
852 | |
850 | Queues the given scalar to be written. You can push as much data as you |
853 | Queues the given scalar to be written. You can push as much data as you |
851 | want (only limited by the available memory), as C<AnyEvent::Handle> |
854 | want (only limited by the available memory), as C<AnyEvent::Handle> |
852 | buffers it independently of the kernel. |
855 | buffers it independently of the kernel. |
|
|
856 | |
|
|
857 | This method may invoke callbacks (and therefore the handle might be |
|
|
858 | destroyed after it returns). |
853 | |
859 | |
854 | =cut |
860 | =cut |
855 | |
861 | |
856 | sub _drain_wbuf { |
862 | sub _drain_wbuf { |
857 | my ($self) = @_; |
863 | my ($self) = @_; |
… | |
… | |
1033 | This simply shuts down the write side and signals an EOF condition to the |
1039 | This simply shuts down the write side and signals an EOF condition to the |
1034 | the peer. |
1040 | the peer. |
1035 | |
1041 | |
1036 | You can rely on the normal read queue and C<on_eof> handling |
1042 | You can rely on the normal read queue and C<on_eof> handling |
1037 | afterwards. This is the cleanest way to close a connection. |
1043 | afterwards. This is the cleanest way to close a connection. |
|
|
1044 | |
|
|
1045 | This method may invoke callbacks (and therefore the handle might be |
|
|
1046 | destroyed after it returns). |
1038 | |
1047 | |
1039 | =cut |
1048 | =cut |
1040 | |
1049 | |
1041 | sub push_shutdown { |
1050 | sub push_shutdown { |
1042 | my ($self) = @_; |
1051 | my ($self) = @_; |
… | |
… | |
1239 | |
1248 | |
1240 | This replaces the currently set C<on_read> callback, or clears it (when |
1249 | This replaces the currently set C<on_read> callback, or clears it (when |
1241 | the new callback is C<undef>). See the description of C<on_read> in the |
1250 | the new callback is C<undef>). See the description of C<on_read> in the |
1242 | constructor. |
1251 | constructor. |
1243 | |
1252 | |
|
|
1253 | This method may invoke callbacks (and therefore the handle might be |
|
|
1254 | destroyed after it returns). |
|
|
1255 | |
1244 | =cut |
1256 | =cut |
1245 | |
1257 | |
1246 | sub on_read { |
1258 | sub on_read { |
1247 | my ($self, $cb) = @_; |
1259 | my ($self, $cb) = @_; |
1248 | |
1260 | |
… | |
… | |
1286 | available (or an error condition is detected). |
1298 | available (or an error condition is detected). |
1287 | |
1299 | |
1288 | If enough data was available, then the callback must remove all data it is |
1300 | If enough data was available, then the callback must remove all data it is |
1289 | interested in (which can be none at all) and return a true value. After returning |
1301 | interested in (which can be none at all) and return a true value. After returning |
1290 | true, it will be removed from the queue. |
1302 | true, it will be removed from the queue. |
|
|
1303 | |
|
|
1304 | These methods may invoke callbacks (and therefore the handle might be |
|
|
1305 | destroyed after it returns). |
1291 | |
1306 | |
1292 | =cut |
1307 | =cut |
1293 | |
1308 | |
1294 | our %RH; |
1309 | our %RH; |
1295 | |
1310 | |
… | |
… | |
1851 | when this function returns. |
1866 | when this function returns. |
1852 | |
1867 | |
1853 | Due to bugs in OpenSSL, it might or might not be possible to do multiple |
1868 | Due to bugs in OpenSSL, it might or might not be possible to do multiple |
1854 | handshakes on the same stream. Best do not attempt to use the stream after |
1869 | handshakes on the same stream. Best do not attempt to use the stream after |
1855 | stopping TLS. |
1870 | stopping TLS. |
|
|
1871 | |
|
|
1872 | This method may invoke callbacks (and therefore the handle might be |
|
|
1873 | destroyed after it returns). |
1856 | |
1874 | |
1857 | =cut |
1875 | =cut |
1858 | |
1876 | |
1859 | our %TLS_CACHE; #TODO not yet documented, should we? |
1877 | our %TLS_CACHE; #TODO not yet documented, should we? |
1860 | |
1878 | |
… | |
… | |
1929 | Shuts down the SSL connection - this makes a proper EOF handshake by |
1947 | Shuts down the SSL connection - this makes a proper EOF handshake by |
1930 | sending a close notify to the other side, but since OpenSSL doesn't |
1948 | sending a close notify to the other side, but since OpenSSL doesn't |
1931 | support non-blocking shut downs, it is not guaranteed that you can re-use |
1949 | support non-blocking shut downs, it is not guaranteed that you can re-use |
1932 | the stream afterwards. |
1950 | the stream afterwards. |
1933 | |
1951 | |
|
|
1952 | This method may invoke callbacks (and therefore the handle might be |
|
|
1953 | destroyed after it returns). |
|
|
1954 | |
1934 | =cut |
1955 | =cut |
1935 | |
1956 | |
1936 | sub stoptls { |
1957 | sub stoptls { |
1937 | my ($self) = @_; |
1958 | my ($self) = @_; |
1938 | |
1959 | |