WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@fcecin
Copy link
Contributor

@fcecin fcecin commented Dec 5, 2025

Overview

This PR helps address logos-messaging/logos-messaging-nim#3634 by adding public APIs acceptStream and processHttpRequest to HttpServer.

Also added a "Test accept" test suite which tests both accept and acceptStream with processHttpRequest.

Rationale

Client code that doesn't tolerate the head-of-line blocking of the existing accept API can instead (i) call acceptStream in a loop, in a dedicated task to create remote-client sockets from the server socket, and (ii) spawn new tasks to call processHttpRequest and wait for and process HTTP headers arriving from the client socket (which can take a long time and shouldn't block new remote-client sockets).

Alternatives (tried before):

* add HttpServer.acceptStream
* add HttpServer.processHttpHeaders
* add "Test accept" test suite
fcecin added a commit to vacp2p/nim-libp2p that referenced this pull request Dec 5, 2025
* use HttpServer.acceptStream and HttpServer.processHttpRequest
for concurrent accept (depends on: status-im/nim-websock#181)
* set DefaultConcurrentAccepts to 200 connections
* fix parallel streaming data test
* remove use of deprecated handshakeTimeout HttpServer param
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant