This repository has been archived by the owner on Jun 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Based on https://github.com/ellzey/libevhtp/pull/126 @simonas added a function to setup the listener on an already bound socket. The only problem I had was the duplicate code; so I fixed it in this manner (and it flows quite well) evhtp_bind_socket parses the data to which the server will listen on, then creates a struct sockaddr. evhtp_bind_socket then calls evhtp_bind_sockaddr, which creates the socket, sets some options, and calls bind. evhtp_bind_sockaddr will then call evhtp_accept_socket with the newly created socket. evhtp_accept_socket will then create the listener context using only that file descriptor (and the evhtp_t structure). The result is clean and exactly what @simonas wanted without the code duplication.
- Loading branch information
Mark Ellzey
committed
Nov 26, 2015
1 parent
bd70b5e
commit a497a14
Showing
1 changed file
with
46 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters