Skip to content

Commit

Permalink
Expand optional_socket_server -> std::optional<socket_server>
Browse files Browse the repository at this point in the history
As commented in longturn#888, it didn't improve readability -- rather the opposite.
  • Loading branch information
lmoureaux committed Dec 27, 2023
1 parent e87fda8 commit 1d3a1f0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion server/sernet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ int server_make_connection(QIODevice *new_sock, const QString &client_addr,
Open server socket to be used to accept client connections
and open a server socket for server LAN announcements.
*/
optional_socket_server server_open_socket()
std::optional<socket_server> server_open_socket()
{
// Local socket mode
if (!srvarg.local_addr.isEmpty()) {
Expand Down
3 changes: 1 addition & 2 deletions server/sernet.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ struct connection;

using socket_server =
std::variant<std::unique_ptr<QTcpServer>, std::unique_ptr<QLocalServer>>;
using optional_socket_server = std::optional<socket_server>;

optional_socket_server server_open_socket();
std::optional<socket_server> server_open_socket();
void flush_packets();
void incoming_client_packets(connection *pconn);
void close_connections_and_socket();
Expand Down
2 changes: 1 addition & 1 deletion server/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ void fc_interface_init_server()
/**
Server initialization.
*/
optional_socket_server srv_prepare()
std::optional<socket_server> srv_prepare()
{
// make sure it's initialized
srv_init();
Expand Down

0 comments on commit 1d3a1f0

Please sign in to comment.