Commit 5c3a9056 authored by Olivier Crête's avatar Olivier Crête

tests: Close pseudosocket as soon as it's done sending

parent 8dce6c13
...@@ -116,15 +116,13 @@ static void readable (PseudoTcpSocket *sock, gpointer data) ...@@ -116,15 +116,13 @@ static void readable (PseudoTcpSocket *sock, gpointer data)
total_wrote += len; total_wrote += len;
g_debug ("Written %d bytes, need %d bytes", total_wrote, total_read); g_debug ("Written %d bytes, need %d bytes", total_wrote, total_read);
if (total_wrote >= total_read && feof (in)) { if (total_wrote == total_read && feof (in)) {
pseudo_tcp_socket_close (left, FALSE); pseudo_tcp_socket_close (sock, FALSE);
pseudo_tcp_socket_close (right, FALSE);
} }
} }
} else { } else {
if (len == 26 && strncmp (buf, "abcdefghijklmnopqrstuvwxyz", len) == 0) { if (len == 26 && strncmp (buf, "abcdefghijklmnopqrstuvwxyz", len) == 0) {
pseudo_tcp_socket_close (left, FALSE); pseudo_tcp_socket_close (sock, FALSE);
pseudo_tcp_socket_close (right, FALSE);
} else { } else {
g_debug ("Error reading data.. read %d bytes : %s", len, buf); g_debug ("Error reading data.. read %d bytes : %s", len, buf);
exit (-1); exit (-1);
...@@ -144,7 +142,7 @@ static void readable (PseudoTcpSocket *sock, gpointer data) ...@@ -144,7 +142,7 @@ static void readable (PseudoTcpSocket *sock, gpointer data)
static void writable (PseudoTcpSocket *sock, gpointer data) static void writable (PseudoTcpSocket *sock, gpointer data)
{ {
g_debug ("Socket %p Writable", sock); g_debug ("Socket %p Writable", sock);
if (in) if (in && sock == left)
write_to_sock (sock); write_to_sock (sock);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment