New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with persistent raw TCP connection #807

Closed
luismarques opened this Issue Sep 4, 2014 · 0 comments

Comments

Projects
None yet
1 participant
@luismarques

luismarques commented Sep 4, 2014

This does not work correctly:

TCPConnection tcpConnection;

shared static this()
{
    setLogLevel(LogLevel.debugV); 
    auto settings = new HTTPServerSettings;
    settings.port = 8080;
    listenHTTP(settings, &handleRequest);

    listenTCP(3838, (conn)
    {
        tcpConnection = conn;
        logDiagnostic("TCP connected");
    }, TCPListenOptions.disableAutoClose);
}

void handleRequest(HTTPServerRequest req,
                   HTTPServerResponse res)
{
    tcpConnection.write("foo\n");
    res.writeBody("Hello, World!", "text/plain");
}

When the HTTP request is handled, nothing is written to the raw TCP connection and the HTTP request gets stuck. Eventually the application crashes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment