From 4e5a65295ad732fd53630d8c29912ec047038d9d Mon Sep 17 00:00:00 2001 From: FlavioJS Date: Mon, 8 Jan 2007 08:35:32 +0000 Subject: - Added a precompiler error when the shutdown defines are not found. - Added parse_console to the plugin API. - Added plugin for parsing the console. (working with cygwin) - Added the console plugin to plugin_athena.conf commented out. - Copied the parse_console code form login txt to login sql and char. - Added propper plugin version compatibility tests. - Better output when a plugin fails to load. ----- The console plugin (at it's 3rd version) uses two pipes and another thread. - the other thread reads data from stdin and sends it through one of the pipes - the other pipe serves as semaphore (and terminator) to that thread - the normal thread checks if the pipe has data once every timer cycle, if data is found it invokes parse_console with that data Worth noting: the first version didn't use another thread and just checked if data was available on the input stream, but apparently that can't be done to standard input in windows It's only been tested on cygwin (and should work on most *nix systems), can't test native windows right now because I'm having trouble exporting the required plugin variables in VS8 src/plugins/Makefile hasn't been updated because it's not working properly for me git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9631 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/common/socket.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/common/socket.c') diff --git a/src/common/socket.c b/src/common/socket.c index 04793094c..3d445d286 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -57,10 +57,14 @@ #include "../common/showmsg.h" /// shutdown() constants -#if defined(SD_RECEIVE) && !defined(SHUT_RD) -#define SHUT_RD SD_RECEIVE -#define SHUT_WR SD_SEND -#define SHUT_RDWR SD_BOTH +#ifndef SHUT_RD +#ifdef SD_RECEIVE + #define SHUT_RD SD_RECEIVE + #define SHUT_WR SD_SEND + #define SHUT_RDWR SD_BOTH +#else + #error "Unknown socket constants, please report this to a developer" +#endif #endif fd_set readfds; @@ -423,12 +427,12 @@ void func_parse_check (struct socket_data *sd) } // Console Input [Wizputer] -int start_console(void) { - +int start_console(void) +{ //Until a better plan is came up with... can't be using session[0] anymore! [Skotlex] ShowNotice("The console is currently nonfunctional.\n"); return 0; - + FD_SET(0,&readfds); if (!session[0]) { // dummy socket already uses fd 0 @@ -1197,7 +1201,7 @@ int socket_getips(uint32 *ips, int max) void socket_init(void) { char *SOCKET_CONF_FILENAME = "conf/packet_athena.conf"; - + #ifdef WIN32 {// Start up windows networking WSADATA wsaData; -- cgit v1.2.3-70-g09d2