UWNetworksLab / uProxy-p2p

Internet without borders

Home Page:https://www.uproxy.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tcp.connection.onceClosed resolves with the wrong value when it closes the connection

trevj opened this issue · comments

commented

Two core.tcpsocket wrapper tests are failing:

grunt tcpIntegrationTest
*   core.tcpsocket wrapper listens and echoes
*   core.tcpsocket wrapper sends onceShutdown notifications
X   core.tcpsocket wrapper onceClosed by server
X   core.tcpsocket wrapper onceClosed by client
*   core.tcpsocket wrapper onceClosed returns NEVER_CONNECTED when client connection fails
*   core.tcpsocket wrapper serves multiple clients
*   core.tcpsocket wrapper connectionsCount
>> 2 failures

The problem is that the connection.onceClosed is resolving with tcp.SocketCloseKind.REMOTELY_CLOSED - even though that's the object which closed the connection:
https://github.com/uProxy/uproxy/blob/master/src/lib/integration-tests/tcp/freedom-module.ts#L78

commented

I believe this may be a freedom-for-chrome issue by which freedom sends us the close event after the object has been reclaimed:

Unchecked runtime.lastError while running sockets.tcpServer.close: Socket not found
    at Socket_chrome.dispatchDisconnect (chrome-extension://khhlpmfebmkkibipnllkeanfadmigbnj/files/freedom-for-chrome/freedom-for-chrome.js:1713:20)
    at Socket_chrome.<anonymous> (chrome-extension://khhlpmfebmkkibipnllkeanfadmigbnj/files/freedom-for-chrome/freedom-for-chrome.js:1931:12)

Why the counter doesn't help with this I don't know:
https://github.com/uProxy/uproxy/blob/master/src/lib/net/tcp.ts#L418

commented

OK, something has changed in Chrome's socket library. I filed this issue to investigate further:
freedomjs/freedom-for-chrome#90