-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chat server #39
Chat server #39
Conversation
Create initial CMakeList Implement basic version of chat server
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we shouldn't use :unique_ptr to raw pointers, this may cause memory problems
qInfo() << "Server listening on port " << port; | ||
connect(m_webSocketServer, &QWebSocketServer::newConnection, this, &ChatServer::onNewConnection); | ||
connect(&*m_webSocketServer, &QWebSocketServer::newConnection, this, &ChatServer::onNewConnection); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use m_webSocketServer.get()
} | ||
|
||
ChatServer::ChatServer(quint16 port, QObject *parent) | ||
ChatServer::ChatServer(quint16 port, QObject* parent) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const?
QWebSocketServer* m_webSocketServer; | ||
QList<QWebSocket*> m_clients; | ||
std::unique_ptr<QWebSocketServer> m_webSocketServer; | ||
std::vector<std::unique_ptr<QWebSocket*>> m_clients; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we shouldn't use std::vector<std::unique_ptr to raw pointers, this may cause memory problems
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have other idea? We have to store QWebSocket*, there is no option to store as a normal type
@Vicx95 Your solution has not passed all checks (maybe it was only a formatting-check?) and you haven't modified this Pull Request during the last 7 days. It will be automatically closed after the next 7 days if it remains untouched. |
1 similar comment
@Vicx95 Your solution has not passed all checks (maybe it was only a formatting-check?) and you haven't modified this Pull Request during the last 7 days. It will be automatically closed after the next 7 days if it remains untouched. |
We are closing this PR. If you want to fix your code and get points, please re-open it or raise a new PR |
No description provided.