MCPcopy Create free account
hub / github.com/SIPp/sipp / write_error

Method write_error

src/socket.cpp:1836–1879  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1834}
1835
1836int SIPpSocket::write_error(int ret)
1837{
1838 const char *errstring = strerror(errno);
1839
1840#ifndef EAGAIN
1841 int again = (errno == EWOULDBLOCK) ? errno : 0;
1842#else
1843 int again = ((errno == EAGAIN) || (errno == EWOULDBLOCK)) ? errno : 0;
1844
1845 /* Scrub away EAGAIN from the rest of the code. */
1846 if (errno == EAGAIN) {
1847 errno = EWOULDBLOCK;
1848 }
1849#endif
1850
1851 if (again) {
1852 return enter_congestion(again);
1853 }
1854
1855 if ((ss_transport == T_TCP || ss_transport == T_SCTP)
1856 && errno == EPIPE) {
1857 nb_net_send_errors++;
1858 sockets_pending_reset.insert(this);
1859 abort();
1860 if (reconnect_allowed()) {
1861 WARNING("Broken pipe on TCP connection, remote peer "
1862 "probably closed the socket");
1863 } else {
1864 ERROR("Broken pipe on TCP connection, remote peer "
1865 "probably closed the socket");
1866 }
1867 return -1;
1868 }
1869
1870#if defined(USE_OPENSSL) || defined(USE_WOLFSSL)
1871 if (ss_transport == T_TLS) {
1872 errstring = SSL_error_string(SSL_get_error(ss_ssl, ret), ret);
1873 }
1874#endif
1875
1876 WARNING("Unable to send %s message: %s", TRANSPORT_TO_STRING(ss_transport), errstring);
1877 nb_net_send_errors++;
1878 return -1;
1879}
1880
1881int SIPpSocket::read_error(int ret)
1882{

Callers

nothing calls this directly

Calls 5

reconnect_allowedFunction · 0.85
WARNINGFunction · 0.85
ERRORFunction · 0.85
SSL_error_stringFunction · 0.85
insertMethod · 0.80

Tested by

no test coverage detected