I will try to sketch below a simple pseudo-code of a simple TCP proxy. Please share your thoughts.

```
Socket A: EV_READ | EV_EOF, callback read_socket_a
Socket B: EV_WRITE | EV_EOF, callback write_socket_b

// 1 Gbps link
read_socket_a:
  if flags & EV_EOF
    close socket_a, close socket_b
    return -1;

  if send_buffer_is_full
    return 0; // try next time
  else
    recv and append data to send_buffer

// 56 Kbps link
write_socket_b:
  if flags & EV_EOF
    close socket_b, close socket_a
    return -1;

  if send_buffer_has_data
    send data to socket_b
    send_buffer -= data_sent
```

It's a very simple pseudo-code, obviously. If the socket A gets stuck, it will timeout and we would receive an EV_EOF without reading all the pending data, and thus closing both sockets. If socket B closes/drops it's connection somehow, we will be notified, thus closing both sockets. What are your thoughts on it?