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

Method flush

src/socket.cpp:2159–2185  ·  view source on GitHub ↗

Flush any output buffers for this socket. */

Source from the content-addressed store, hash-verified

2157
2158/* Flush any output buffers for this socket. */
2159int SIPpSocket::flush()
2160{
2161 struct socketbuf *buf;
2162 int ret;
2163
2164 while ((buf = ss_out)) {
2165 ssize_t size = buf->len - buf->offset;
2166 ret = write_primitive(buf->buf + buf->offset, size, &buf->addr);
2167 TRACE_MSG("Wrote %d of %zu bytes in an output buffer.\n", ret, size);
2168 if (ret == size) {
2169 /* Everything is great, throw away this buffer. */
2170 ss_out = buf->next;
2171 free_socketbuf(buf);
2172 } else if (ret <= 0) {
2173 /* Handle connection closes and errors. */
2174 return write_error(ret);
2175 } else {
2176 /* We have written more of the partial buffer. */
2177 buf->offset += ret;
2178 errno = EWOULDBLOCK;
2179 enter_congestion(EWOULDBLOCK);
2180 return -1;
2181 }
2182 }
2183
2184 return 0;
2185}
2186
2187/* Write data to a socket. */
2188int SIPpSocket::write(const char *buffer, ssize_t len, int flags, struct sockaddr_storage *dest)

Callers 3

dumpDataMethod · 0.80
dumpDataRttMethod · 0.80
socket.cppFile · 0.80

Calls 2

TRACE_MSGFunction · 0.85
free_socketbufFunction · 0.85

Tested by

no test coverage detected