Skip to content

Commit e837df4

Browse files
author
lh5053
committed
Updates TODOs
1 parent 8d969cd commit e837df4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Router.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,18 @@ int Router::init_socket() {
7676
// TODO error handling (what if there's no memory available)
7777
memset(&listening_socket_description, 0, sizeof listening_socket_description);
7878

79+
// TODO add option to listen on a particular address
7980
listening_socket_description.ai_family = AF_UNSPEC; // use IPv4 or IPv6, whichever
8081
listening_socket_description.ai_socktype = SOCK_STREAM;
8182
listening_socket_description.ai_flags = AI_PASSIVE; // fill in my IP for me
8283
getaddrinfo(NULL, this->port.c_str(), &listening_socket_description, &this->addr);
8384

84-
// TODO error handling (what if we cannot open the socket)
8585
int listening_socket = socket(this->addr->ai_family, this->addr->ai_socktype, this->addr->ai_protocol);
8686
if (listening_socket < 0) {
8787
char * err = std::strerror(errno);
8888
throw Router::Exception("Error opening socket: " + std::string(err ? err : "unknown error"));
8989
}
9090

91-
// TODO error handling (what if we can't bind)
9291
int check = bind(listening_socket, this->addr->ai_addr, this->addr->ai_addrlen);
9392
if (check < 0) {
9493
char * err = std::strerror(errno);

src/Worker.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ void Worker::handle_request() {
4040
// get the static file contents
4141
std::string req_str = std::string(request);
4242

43+
// TODO replace with some actual request parser (to be part of BasicHTTP)
4344
int space_count = 0;
4445
size_t pos = 0, prev_pos = 0;
4546
while (space_count < 2) {

0 commit comments

Comments
 (0)