Fixed connection closing method, and fixed a logout/login problem
Signed-off-by: Gergely POLONKAI <polesz@w00d5t0ck.info>
This commit is contained in:
parent
e8660f2a31
commit
4e479e0045
@ -79,8 +79,10 @@ wmud_client_close(wmudClient *client, gboolean send_goodbye)
|
|||||||
wmud_client_send(client, "\r\nHave a nice real-world day!\r\n\r\n");
|
wmud_client_send(client, "\r\nHave a nice real-world day!\r\n\r\n");
|
||||||
|
|
||||||
g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "Connection closed.");
|
g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "Connection closed.");
|
||||||
g_socket_close(client->socket, NULL);
|
g_socket_shutdown(client->socket, TRUE, TRUE, NULL);
|
||||||
clients = g_slist_remove(clients, client);
|
clients = g_slist_remove(clients, client);
|
||||||
|
if (client->player)
|
||||||
|
if (!client->player->registered)
|
||||||
wmud_player_free(&(client->player));
|
wmud_player_free(&(client->player));
|
||||||
if (client->buffer)
|
if (client->buffer)
|
||||||
g_string_free(client->buffer, TRUE);
|
g_string_free(client->buffer, TRUE);
|
||||||
@ -201,6 +203,7 @@ wmud_client_callback(GSocket *client_socket, GIOCondition condition, wmudClient
|
|||||||
{
|
{
|
||||||
client->state = WMUD_CLIENT_STATE_PASSWAIT;
|
client->state = WMUD_CLIENT_STATE_PASSWAIT;
|
||||||
client->player = player;
|
client->player = player;
|
||||||
|
client->player->registered = TRUE;
|
||||||
wmud_client_send(client, "Please provide us your password: %c%c%c", TELNET_IAC, TELNET_WILL, TELNET_ECHO);
|
wmud_client_send(client, "Please provide us your password: %c%c%c", TELNET_IAC, TELNET_WILL, TELNET_ECHO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,6 +83,7 @@ typedef struct _wmudPlayer {
|
|||||||
gchar *cpassword;
|
gchar *cpassword;
|
||||||
gchar *email;
|
gchar *email;
|
||||||
gint fail_count;
|
gint fail_count;
|
||||||
|
gboolean registered;
|
||||||
} wmudPlayer;
|
} wmudPlayer;
|
||||||
|
|
||||||
typedef struct _wmudClient wmudClient;
|
typedef struct _wmudClient wmudClient;
|
||||||
|
Loading…
Reference in New Issue
Block a user