MCPcopy Create free account
hub / github.com/axboe/liburing / handle_cqe

Function handle_cqe

examples/proxy.c:1900–1959  ·  view source on GitHub ↗

* Called for each CQE that we receive. Decode the request type that it * came from, and call the appropriate handler. */

Source from the content-addressed store, hash-verified

1898 * came from, and call the appropriate handler.
1899 */
1900static int handle_cqe(struct io_uring *ring, struct io_uring_cqe *cqe)
1901{
1902 int ret;
1903
1904 /*
1905 * Unlikely, but there's an error in this CQE. If an error handler
1906 * is defined, call it, and that will deal with it. If no error
1907 * handler is defined, the opcode handler either doesn't care or will
1908 * handle it on its own.
1909 */
1910 if (cqe->res < 0) {
1911 struct error_handler *err = &error_handlers[cqe_to_op(cqe)];
1912
1913 if (err->error_fn)
1914 return err->error_fn(err, ring, cqe);
1915 }
1916
1917 switch (cqe_to_op(cqe)) {
1918 case __ACCEPT:
1919 ret = handle_accept(ring, cqe);
1920 break;
1921 case __SOCK:
1922 ret = handle_sock(ring, cqe);
1923 break;
1924 case __CONNECT:
1925 ret = handle_connect(ring, cqe);
1926 break;
1927 case __RECV:
1928 case __RECVMSG:
1929 ret = handle_recv(ring, cqe);
1930 break;
1931 case __SEND:
1932 case __SENDMSG:
1933 ret = handle_send(ring, cqe);
1934 break;
1935 case __CANCEL:
1936 ret = handle_cancel(ring, cqe);
1937 break;
1938 case __SHUTDOWN:
1939 ret = handle_shutdown(ring, cqe);
1940 break;
1941 case __CLOSE:
1942 ret = handle_close(ring, cqe);
1943 break;
1944 case __FD_PASS:
1945 ret = handle_fd_pass(cqe);
1946 break;
1947 case __STOP:
1948 ret = handle_stop(cqe);
1949 break;
1950 case __NOP:
1951 ret = 0;
1952 break;
1953 default:
1954 fprintf(stderr, "bad user data %lx\n", (long) cqe->user_data);
1955 return 1;
1956 }
1957

Callers 1

__event_loopFunction · 0.70

Calls 11

cqe_to_opFunction · 0.85
handle_sockFunction · 0.85
handle_connectFunction · 0.85
handle_cancelFunction · 0.85
handle_shutdownFunction · 0.85
handle_closeFunction · 0.85
handle_fd_passFunction · 0.85
handle_stopFunction · 0.85
handle_acceptFunction · 0.70
handle_recvFunction · 0.70
handle_sendFunction · 0.70

Tested by

no test coverage detected