Skip to content

Instantly share code, notes, and snippets.

@mfournier
Created July 26, 2013 11:57
Show Gist options
  • Save mfournier/6088320 to your computer and use it in GitHub Desktop.
Save mfournier/6088320 to your computer and use it in GitHub Desktop.
Connection refused issue
--- src/statsd-tg.c
+++ src/statsd-tg.c
@@ -202,7 +202,10 @@ static int send_random_event (int sock, unsigned short seed[static 3]) /* {{{ */
return (-1);
assert (buffer[buffer_size] == 0);
+ fprintf (stderr, "errno is: %i, strerror is: %s\n", errno, strerror(errno));
status = send (sock, buffer, (size_t) buffer_size, /* flags = */ 0);
+
+ fprintf (stderr, "send status is: %i, strerror is: %s\n", status, strerror(errno));
if (status < 0)
{
fprintf (stderr, "send failed: %s\n", strerror (errno));
@@ -310,6 +313,7 @@ static void *send_thread (void *args __attribute__((unused))) /* {{{ */
seed[0] = (unsigned short) (ts.tv_sec);
sock = sock_open ();
+ fprintf (stderr, "sock is: %i\n", sock);
while (loop)
{
$ timeout 1 src/statsd-tg -T 12 2>&1 | head -50
sock is: 3
errno is: 0, strerror is: Success
send status is: 13, strerror is: Success
errno is: 0, strerror is: Success
send status is: -1, strerror is: Connection refused
send failed: Connection refused
errno is: 111, strerror is: Connection refused
send status is: 10, strerror is: Connection refused
errno is: 111, strerror is: Connection refused
send status is: -1, strerror is: Connection refused
send failed: Connection refused
errno is: 111, strerror is: Connection refused
send status is: 14, strerror is: Connection refused
errno is: 111, strerror is: Connection refused
send status is: -1, strerror is: Connection refused
send failed: Connection refused
errno is: 111, strerror is: Connection refused
send status is: 10, strerror is: Connection refused
errno is: 111, strerror is: Connection refused
send status is: -1, strerror is: Connection refused
send failed: Connection refused
errno is: 111, strerror is: Connection refused
send status is: 10, strerror is: Connection refused
errno is: 111, strerror is: Connection refused
send status is: -1, strerror is: Connection refused
send failed: Connection refused
errno is: 111, strerror is: Connection refused
send status is: 13, strerror is: Connection refused
errno is: 111, strerror is: Connection refused
send status is: -1, strerror is: Connection refused
send failed: Connection refused
errno is: 111, strerror is: Connection refused
send status is: 13, strerror is: Connection refused
sock is: 9
errno is: 0, strerror is: Success
send status is: 12, strerror is: Success
errno is: 0, strerror is: Success
send status is: -1, strerror is: Connection refused
send failed: Connection refused
errno is: 111, strerror is: Connection refused
send status is: 13, strerror is: Connection refused
errno is: 111, strerror is: Connection refused
send status is: -1, strerror is: Connection refused
send failed: Connection refused
[...]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment