Annotation of embedaddon/curl/docs/libcurl/curl_easy_pause.3, revision 1.1

1.1     ! misho       1: .\" **************************************************************************
        !             2: .\" *                                  _   _ ____  _
        !             3: .\" *  Project                     ___| | | |  _ \| |
        !             4: .\" *                             / __| | | | |_) | |
        !             5: .\" *                            | (__| |_| |  _ <| |___
        !             6: .\" *                             \___|\___/|_| \_\_____|
        !             7: .\" *
        !             8: .\" * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
        !             9: .\" *
        !            10: .\" * This software is licensed as described in the file COPYING, which
        !            11: .\" * you should have received as part of this distribution. The terms
        !            12: .\" * are also available at https://curl.haxx.se/docs/copyright.html.
        !            13: .\" *
        !            14: .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
        !            15: .\" * copies of the Software, and permit persons to whom the Software is
        !            16: .\" * furnished to do so, under the terms of the COPYING file.
        !            17: .\" *
        !            18: .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
        !            19: .\" * KIND, either express or implied.
        !            20: .\" *
        !            21: .\" **************************************************************************
        !            22: .TH curl_easy_pause 3 "May 01, 2016" "libcurl 7.70.0" "libcurl Manual"
        !            23: 
        !            24: .SH NAME
        !            25: curl_easy_pause - pause and unpause a connection
        !            26: .SH SYNOPSIS
        !            27: .B #include <curl/curl.h>
        !            28: 
        !            29: .BI "CURLcode curl_easy_pause(CURL *"handle ", int "bitmask " );"
        !            30: 
        !            31: .SH DESCRIPTION
        !            32: Using this function, you can explicitly mark a running connection to get
        !            33: paused, and you can unpause a connection that was previously paused.
        !            34: 
        !            35: A connection can be paused by using this function or by letting the read or
        !            36: the write callbacks return the proper magic return code
        !            37: (\fICURL_READFUNC_PAUSE\fP and \fICURL_WRITEFUNC_PAUSE\fP). A write callback
        !            38: that returns pause signals to the library that it couldn't take care of any
        !            39: data at all, and that data will then be delivered again to the callback when
        !            40: the writing is later unpaused.
        !            41: 
        !            42: While it may feel tempting, take care and notice that you cannot call this
        !            43: function from another thread. To unpause, you may for example call it from the
        !            44: progress callback (\fICURLOPT_PROGRESSFUNCTION(3)\fP), which gets called at
        !            45: least once per second, even if the connection is paused.
        !            46: 
        !            47: When this function is called to unpause reading, the chance is high that you
        !            48: will get your write callback called before this function returns.
        !            49: 
        !            50: The \fBhandle\fP argument is of course identifying the handle that operates on
        !            51: the connection you want to pause or unpause.
        !            52: 
        !            53: The \fBbitmask\fP argument is a set of bits that sets the new state of the
        !            54: connection. The following bits can be used:
        !            55: .IP CURLPAUSE_RECV
        !            56: Pause receiving data. There will be no data received on this connection until
        !            57: this function is called again without this bit set. Thus, the write callback
        !            58: (\fICURLOPT_WRITEFUNCTION(3)\fP) won't be called.
        !            59: .IP CURLPAUSE_SEND
        !            60: Pause sending data. There will be no data sent on this connection until this
        !            61: function is called again without this bit set. Thus, the read callback
        !            62: (\fICURLOPT_READFUNCTION(3)\fP) won't be called.
        !            63: .IP CURLPAUSE_ALL
        !            64: Convenience define that pauses both directions.
        !            65: .IP CURLPAUSE_CONT
        !            66: Convenience define that unpauses both directions.
        !            67: .SH RETURN VALUE
        !            68: CURLE_OK (zero) means that the option was set properly, and a non-zero return
        !            69: code means something wrong occurred after the new state was set.  See the
        !            70: \fIlibcurl-errors(3)\fP man page for the full list with descriptions.
        !            71: .SH LIMITATIONS
        !            72: The pausing of transfers does not work with protocols that work without
        !            73: network connectivity, like FILE://. Trying to pause such a transfer, in any
        !            74: direction, will cause problems in the worst case or an error in the best case.
        !            75: .SH AVAILABILITY
        !            76: This function was added in libcurl 7.18.0. Before this version, there was no
        !            77: explicit support for pausing transfers.
        !            78: .SH "USAGE WITH THE MULTI-SOCKET INTERFACE"
        !            79: Before libcurl 7.32.0, when a specific handle was unpaused with this function,
        !            80: there was no particular forced rechecking or similar of the socket's state,
        !            81: which made the continuation of the transfer get delayed until next
        !            82: multi-socket call invoke or even longer. Alternatively, the user could
        !            83: forcibly call for example \fIcurl_multi_socket_all(3)\fP - with a rather hefty
        !            84: performance penalty.
        !            85: 
        !            86: Starting in libcurl 7.32.0, unpausing a transfer will schedule a timeout
        !            87: trigger for that handle 1 millisecond into the future, so that a
        !            88: curl_multi_socket_action( ... CURL_SOCKET_TIMEOUT) can be used immediately
        !            89: afterwards to get the transfer going again as desired.
        !            90: .SH "MEMORY USE"
        !            91: When pausing a read by returning the magic return code from a write callback,
        !            92: the read data is already in libcurl's internal buffers so it'll have to keep
        !            93: it in an allocated buffer until the reading is again unpaused using this
        !            94: function.
        !            95: 
        !            96: If the downloaded data is compressed and is asked to get uncompressed
        !            97: automatically on download, libcurl will continue to uncompress the entire
        !            98: downloaded chunk and it will cache the data uncompressed. This has the side-
        !            99: effect that if you download something that is compressed a lot, it can result
        !           100: in a very large data amount needing to be allocated to save the data during
        !           101: the pause. This said, you should probably consider not using paused reading if
        !           102: you allow libcurl to uncompress data automatically.
        !           103: .SH "SEE ALSO"
        !           104: .BR curl_easy_cleanup "(3), " curl_easy_reset "(3)"

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>