Skip to content

Commit

Permalink
Fix port field size (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
nakhodnov17 authored and xphoenix committed Sep 9, 2018
1 parent 4f34fb8 commit bd7adef
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion include/afina/network/Server.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Server {
* listen on the given interface/port pair to process incomming
* data in workers number of threads
*/
virtual void Start(uint32_t port, uint16_t workers = 1) = 0;
virtual void Start(uint16_t port, uint16_t workers = 1) = 0;

/**
* Signal all worker threads that server is going to shutdown. After method returns
Expand Down
2 changes: 1 addition & 1 deletion src/network/blocking/ServerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ ServerImpl::ServerImpl(std::shared_ptr<Afina::Storage> ps) : Server(ps) {}
ServerImpl::~ServerImpl() {}

// See Server.h
void ServerImpl::Start(uint32_t port, uint16_t n_workers) {
void ServerImpl::Start(uint16_t port, uint16_t n_workers) {
std::cout << "network debug: " << __PRETTY_FUNCTION__ << std::endl;

// If a client closes a connection, this will generally produce a SIGPIPE
Expand Down
4 changes: 2 additions & 2 deletions src/network/blocking/ServerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ServerImpl : public Server {
~ServerImpl();

// See Server.h
void Start(uint32_t port, uint16_t workers) override;
void Start(uint16_t port, uint16_t workers) override;

// See Server.h
void Stop() override;
Expand Down Expand Up @@ -61,7 +61,7 @@ class ServerImpl : public Server {
// Port to listen for new connections, permits access only from
// inside of accept_thread
// Read-only
uint32_t listen_port;
uint16_t listen_port;

// Mutex used to access connections list
std::mutex connections_mutex;
Expand Down
2 changes: 1 addition & 1 deletion src/network/nonblocking/ServerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ ServerImpl::ServerImpl(std::shared_ptr<Afina::Storage> ps) : Server(ps) {}
ServerImpl::~ServerImpl() {}

// See Server.h
void ServerImpl::Start(uint32_t port, uint16_t n_workers) {
void ServerImpl::Start(uint16_t port, uint16_t n_workers) {
std::cout << "network debug: " << __PRETTY_FUNCTION__ << std::endl;

// If a client closes a connection, this will generally produce a SIGPIPE
Expand Down
4 changes: 2 additions & 2 deletions src/network/nonblocking/ServerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ServerImpl : public Server {
~ServerImpl();

// See Server.h
void Start(uint32_t port, uint16_t workers) override;
void Start(uint16_t port, uint16_t workers) override;

// See Server.h
void Stop() override;
Expand All @@ -34,7 +34,7 @@ class ServerImpl : public Server {
// Port to listen for new connections, permits access only from
// inside of accept_thread
// Read-only
uint32_t listen_port;
uint16_t listen_port;

// Thread that is accepting new connections
std::vector<Worker> workers;
Expand Down
2 changes: 1 addition & 1 deletion src/network/uv/ServerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ServerImpl::ServerImpl(std::shared_ptr<Afina::Storage> ps) : Server(ps) {}
ServerImpl::~ServerImpl() { assert(workers.size() == 0); }

// See Server.h
void ServerImpl::Start(uint32_t port, uint16_t n_workers) {
void ServerImpl::Start(uint16_t port, uint16_t n_workers) {
struct sockaddr_storage address;
int rc = uv_ip4_addr("0.0.0.0", port, (struct sockaddr_in *)&address);
if (rc != 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/network/uv/ServerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ServerImpl : public Server {
~ServerImpl();

// See Server.h
void Start(uint32_t port, uint16_t workers) override;
void Start(uint16_t port, uint16_t workers) override;

// See Server.h
void Stop() override;
Expand Down

0 comments on commit bd7adef

Please sign in to comment.