Permalink
Commits on Aug 16, 2017
  1. Add connection opening logs

    rom1v committed Aug 16, 2017
    Log new connections as info.
  2. Use Self for associated functions

    rom1v committed Aug 16, 2017
    For consistency, use Self for calling associated functions in the same
    class.
  3. Handle gnirehtet commandline in rustrelay

    rom1v committed Aug 6, 2017
    Expose gnirehtet commands directly in the rustrelay executable, so that
    there is no need for a wrapping shell script.
    
    Consequently, rename rustrelay to gnirehtet (to generate a binary named
    "gnirehtet" or "gnirehtet.exe").
Commits on Aug 15, 2017
  1. Format code

    rom1v committed Aug 8, 2017
    Format code with "cargo fmt".
  2. Improve gradle debug/release/check tasks

    rom1v committed Aug 7, 2017
    The 'release' gradle task should not depend on 'test' or 'check'.
    Instead, request explicitly to execute 'check' in the ./release script.
    
    Rename rust task 'build' to 'debug' for consistency, and expose 'check'
    tasks to the root project.
  3. Add task to cross-compile rustrelay for Windows

    rom1v committed Aug 3, 2017
    Use cargo to generate rustrelay.exe for Windows from Linux.
  4. Build rustrelay through gradle

    rom1v committed Aug 3, 2017
    Expose gradle tasks that just delegates to "cargo", so rustrelay may be
    built along with the other parts of gnirehtet.
  5. Log spurious events as debug

    rom1v committed Aug 3, 2017
    Spurious events are frequent on Windows. This is the expected behavior,
    so there is no need to warn.
  6. Set default log level to Info

    rom1v committed Aug 3, 2017
    Use the same log level in both java and rust versions of the relay
    server.
  7. Fix rust tests warnings

    rom1v committed Aug 3, 2017
    Remove unused import and unnecessary mut.
  8. Ignore spurious wakeups

    rom1v committed Aug 2, 2017
    Poll::poll() may return without events:
    <carllerche/mio#632 (comment)>
    
    Do not panic if that happens.
  9. Ignore spurious events

    rom1v committed Jul 18, 2017
    `poll()` may generate spurious events:
    <https://docs.rs/mio/0.6.9/mio/struct.Poll.html#spurious-events>
    
    Thus, even on a readable or writable event, a call to read() or write()
    may fail with WouldBlock. In that case, we must ignore them:
    
    <carllerche/mio#632 (comment)>
  10. Use Self to call static methods

    rom1v committed Jul 17, 2017
    For consistency, use Self to call static methods (associated functions).
  11. Ignore fmt backup files

    rom1v committed Jul 17, 2017
    The command "cargo fmt" backups files to *.rs.bk. Ignore them in git.
  12. Fix connections expiration

    rom1v committed Jul 15, 2017
    To remove the expired connections, the Vec were iterated forward, and
    its current item was removed when is_expired().
    
    This was incorrect, because a removal impacts indices of items not
    handled yet.
    
    To fix the problem, iterate over the connections backwards.
  13. Make case consistent with standard library

    rom1v committed Jul 13, 2017
    The Rust standard library contains the following types:
     - TcpStream
     - UdpSocket
     - IpAddr
     - Ipv4Addr
    
    For naming consistency, change the case in the following type names:
     - IPv4Header -> Ipv4Header
     - IPv4HeaderData -> Ipv4HeaderData
     - IPv4HeaderMut -> Ipv4HeaderMut
     - IPv4Packet -> Ipv4Packet
     - TCB -> Tcb
     - TCPConnection -> TcpConnection
     - TCPHeader -> TcpHeader
     - TCPHeaderData -> TcpHeaderData
     - TCPHeaderMut -> TcpHeaderMut
     - TCPState -> TcpState
     - UDPConnection -> UdpConnection
     - UDPHeader -> UdpHeader
     - UDPHeaderData -> UdpHeaderData
     - UDPHeaderMut -> UdpHeaderMut
  14. Improve messages on read/write errors

    rom1v committed Jul 13, 2017
    Log the ErrorKind along with the error message.
  15. Ignore event if already closed

    rom1v committed Jul 13, 2017
    An event may be received while the client or connection is already
    closed. For instance, when poll() generates several events, handled
    successively, the first handler may close the connection associated to
    the second handler.
    
    Therefore, ignore the event when the "closed" flag is set.
  16. Move event handlers execution to Selector

    rom1v committed Jul 12, 2017
    Relay does not need to know the internals, it now just calls
    selector.poll() followed by selector.run_handlers().
  17. Defer token removal (fix race condition)

    rom1v committed Jul 12, 2017
    A call to poll() may generate several events, that we handle
    successively.
    
    There was a race condition on deregistration. Suppose that poll()
    generated two events:
     - Token(1) a Client
     - Token(2) a TCPConnection (associated to the client)
    
     During execution of the handler associated to Token(1), the
     TCPConnection is closed, leading to a call to
     selector.deregister(Token(2)).
    
     Then, we want to execute the handler associated to Token(2) (the second
     event), but since it has been deregistered, it does not exist anymore,
     and panic!
    
     To avoid this problem, make Selector.deregister() mark the handlers as
     removed, but kept in selector.handlers until all current event handlers
     are executed.
  18. Do not reregister unnecessarily

    rom1v committed Jul 12, 2017
    The reregister() method must only be called when the handler was already
    registered.
    
    This was harmless though, because it is registered in the if-block, but
    reregistered() should definitely not be called in that case.
  19. Extract tcp_header without "if let" in constructor

    rom1v committed Jul 12, 2017
    Like in other places, extract tcp_heaer without "if let".
    
    For that purpose, move headers instead of borrowing them.
  20. Remove dead code

    rom1v committed Jul 11, 2017
  21. Improve destination rewriting

    rom1v committed Jul 11, 2017
  22. Delete old commented code

    rom1v committed Jul 11, 2017
  23. Log packets sent to client

    rom1v committed Jul 11, 2017
  24. Set packet_for_client_length on deferred

    rom1v committed Jul 11, 2017
    When the client buffer is full, we need to "disable" the TCPConnection
    until the client "pulls" the pending packet.
  25. Fix remaining window

    rom1v committed Jul 11, 2017
  26. Implement TCP client window

    rom1v committed Jul 11, 2017
  27. Fix style

    rom1v committed Jul 11, 2017
  28. Make Selector accept an empty Ready

    rom1v committed Jul 11, 2017
    Poll does not accept to register an empty Ready. For simplifying its
    usage, expose an API that does.
  29. Remove unused RunningState

    rom1v committed Jul 11, 2017