Skip to content

Commit

Permalink
More CR comments from Robert.
Browse files Browse the repository at this point in the history
  • Loading branch information
BillyONeal committed Jul 30, 2018
1 parent 0f86d9e commit 3ab08a5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 22 deletions.
6 changes: 4 additions & 2 deletions Release/include/cpprest/details/basic_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ typedef uint32_t HRESULT; // Needed for PPLX
typedef wchar_t char_t ;
typedef std::wstring string_t;
#define _XPLATSTR(x) L ## x
#define _XPLATTOSTR(x) std::to_wstring(x)
template<typename T>
std::wstring to_tstring(const T& x) { return std::to_wstring(x); }

This comment has been minimized.

Copy link
@garethsb

garethsb Aug 1, 2018

Contributor

to_string_t would make a lot more sense than to_tstring?

This comment has been minimized.

Copy link
@BillyONeal

BillyONeal Aug 1, 2018

Author Member

The name to_string_t was already taken. Note that the current version of this PR doesn't add this.

typedef std::wostringstream ostringstream_t;
typedef std::wofstream ofstream_t;
typedef std::wostream ostream_t;
Expand All @@ -68,7 +69,8 @@ typedef std::wstringstream stringstream_t;
typedef char char_t;
typedef std::string string_t;
#define _XPLATSTR(x) x
#define _XPLATTOSTR(x) std::to_string(x)
template<typename T>
std::string to_tstring(const T& x) { return std::to_string(x); }
typedef std::ostringstream ostringstream_t;
typedef std::ofstream ofstream_t;
typedef std::ostream ostream_t;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ using websocketpp::lib::bind;

using websocketpp::lib::thread;
using websocketpp::lib::mutex;
using websocketpp::lib::lock_guard;
using websocketpp::lib::unique_lock;
using websocketpp::lib::condition_variable;

Expand Down Expand Up @@ -72,30 +71,27 @@ class broadcast_server {
}

void on_open(connection_hdl hdl) {
{
lock_guard<mutex> lock(m_action_lock);
//std::cout << "on_open" << std::endl;
m_actions.push(action(SUBSCRIBE,hdl));
} // unlock
unique_lock<mutex> lock(m_action_lock);
//std::cout << "on_open" << std::endl;
m_actions.push(action(SUBSCRIBE,hdl));
lock.unlock();
m_action_cond.notify_one();
}

void on_close(connection_hdl hdl) {
{
lock_guard<mutex> lock(m_action_lock);
//std::cout << "on_close" << std::endl;
m_actions.push(action(UNSUBSCRIBE,hdl));
} // unlock
unique_lock<mutex> lock(m_action_lock);
//std::cout << "on_close" << std::endl;
m_actions.push(action(UNSUBSCRIBE,hdl));
lock.unlock();
m_action_cond.notify_one();
}

void on_message(connection_hdl hdl, server::message_ptr msg) {
// queue message up for sending by processing thread
{
lock_guard<mutex> lock(m_action_lock);
//std::cout << "on_message" << std::endl;
m_actions.push(action(MESSAGE,hdl,msg));
} // unlock
unique_lock<mutex> lock(m_action_lock);
//std::cout << "on_message" << std::endl;
m_actions.push(action(MESSAGE,hdl,msg));
lock.unlock();
m_action_cond.notify_one();
}

Expand All @@ -113,13 +109,13 @@ class broadcast_server {
lock.unlock();

if (a.type == SUBSCRIBE) {
lock_guard<mutex> con_lock(m_connection_lock);
unique_lock<mutex> con_lock(m_connection_lock);
m_connections.insert(a.hdl);
} else if (a.type == UNSUBSCRIBE) {
lock_guard<mutex> con_lock(m_connection_lock);
unique_lock<mutex> con_lock(m_connection_lock);
m_connections.erase(a.hdl);
} else if (a.type == MESSAGE) {
lock_guard<mutex> con_lock(m_connection_lock);
unique_lock<mutex> con_lock(m_connection_lock);

con_list::iterator it;
for (it = m_connections.begin(); it != m_connections.end(); ++it) {
Expand Down
2 changes: 1 addition & 1 deletion Release/src/http/client/http_client_winhttp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ class winhttp_client final : public _http_client_communicator
if (uri.port() > 0)
{
proxy_str.push_back(_XPLATSTR(':'));
proxy_str.append(_XPLATTOSTR(uri.port()));
proxy_str.append(utility::to_tstring(uri.port()));
}

proxy_name = proxy_str.c_str();
Expand Down

0 comments on commit 3ab08a5

Please sign in to comment.