summaryrefslogtreecommitdiff
path: root/src/common/socket.c
AgeCommit message (Collapse)AuthorFilesLines
2012-06-03cleaned up windows header usage (added one central file to use windows / ↵blacksirius1-2/+1
winapi specific stuff, to be able to set the appropriate flags before including it correctly) Note: this may screw up mingw or cygwin building, ill fix it later... git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16219 54d463be-8e91-2dee-dedb-b68131a5f0ec
2012-04-29- Removed leftover TXT configs, follow-up to r15503.brianluau1-0/+2
- Edited more ***_config_read() functions to show a warning if "Unknown setting" is found. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16009 54d463be-8e91-2dee-dedb-b68131a5f0ec
2012-02-19- reverted part of r15609 since apparently the issue is purely limited to ↵lordttseven1-2/+1
ZC_SKILLINFO_LIST, and this change breaks big storages git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15613 54d463be-8e91-2dee-dedb-b68131a5f0ec
2012-02-18Follow up r15609, fixed gcc warningsshennetsind1-1/+1
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15610 54d463be-8e91-2dee-dedb-b68131a5f0ec
2012-02-18* adjusted socket_max_client_packet to a more accurate (if guessed) value to ↵lordttseven1-1/+2
prevent undefined client behavior (may only affect more recent clients?) + added a workaround for too large ZC_SKILLINFO_LIST packets resulting from all_skill group permission by sending excess skills one by one (bugreport:5348 and bugreport:5349) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15609 54d463be-8e91-2dee-dedb-b68131a5f0ec
2012-02-13Socket init now gives meaningful error description if failed to set socket ↵gepard19841-7/+3
limit (tid:58887). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15574 54d463be-8e91-2dee-dedb-b68131a5f0ec
2012-01-25Added user-friendly socket error messages (bugreport:117).gepard19841-10/+28
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15518 54d463be-8e91-2dee-dedb-b68131a5f0ec
2012-01-15Fixed gm_all_skill, bugreport:5239shennetsind1-12/+13
Removed broken skills from skill tree, so @allskill doesn't give resource errors when gm_all_skill is enabled. Increased maximum client packet size drop limit (was limiting gm_all_skill unnecessarily since the client doesn't crash with it) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15462 54d463be-8e91-2dee-dedb-b68131a5f0ec
2012-01-09Sending to a broken socket will no longer cause SIGPIPE signal to be sent ↵gepard19841-1/+5
back on most *nix systems (those supporting MSG_NOSIGNAL flag) (bugreport:5224) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15415 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-11-17* Added a check to WFIFOSET to detect zero-length 'sets' of packets, that ↵ai4rei1-0/+8
could cause memory corruption (through code after WFIFOHEAD(fd,packet_len(cmd)) where the length is 0). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14995 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-10-16* Added a message indicating how many concurrent connections the server was ↵ai4rei1-0/+4
compiled to support. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14978 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-10-07* Remove fds from the shortlist before processing.flaviojs1-14/+16
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14966 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-09-05* Add consistency checks to the shortlist.flaviojs1-2/+17
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14953 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-07-15* Changed the warning message of when setrlimit fails to be more explicit.flaviojs1-2/+9
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14907 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-07-12* CMake: added search for math.h, added search for socket/nsl library. ↵flaviojs1-0/+3
(tested with Solaris-201011-x86) * Added missing include to socket.c. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14903 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-06-30Replaced custom type 'intptr' with standard 'intptr_t'.ultramage1-1/+1
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14873 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-06-16* Merges from charmerge:flaviojs1-0/+3
- Added DBMap::exists. (r14090) - Added sv_parse_next, a stepped version of sv_parse (delim-separated parser). (r14100 r14104) - Added missing fd check to do_close. (r14145) - Normalized, refactored and restructured some code (in preparation for shutdown/reconnect code). (r14145 r14150) - Changed the char select request code to allow the char-server to reject it. (player in map-server trying to go to char select) (r14150) - Added shutdown support to the servers. (incomplete) (r14152) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14851 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-04-09* Fixed memory corruption when amount of players online approached ↵ai4rei1-4/+1
FD_SETSIZE (topic:262388, bugreport:4856, since r11897). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14781 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-04-08* Fixed a compile error when socket send shortlists are disabled (s->eof ↵ai4rei1-1/+1
instead of s->flag.eof) (follow up to r11930). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14779 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-01-31* Various accumulated cleanups and fixes.ai4rei1-6/+6
- Improved the compile speed for files which include common/socket.h on windows builds (related r10471). - Moved FIFOSIZE_SERVERLINK define from common/mmo.h to common/socket.h (since it is a server connection FIFO size setting). - Fixed script command 'areamobuseskill' canceling monster's skill cast before it determined it's new target, which could be 'none' (bugreport:3272, since r13897). - Added a protection against attempts to read an empty backup / write to a full backup in skill_dance_switch as per TODO from r11347. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14690 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-01-31* Fixed faulty WFIFO reallocation causing memory exhaustion (bugreport:4737, ↵ai4rei1-3/+3
since r1816, related r11503, r11571, r11886 and r12232). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14689 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-01-28* Resolving allow/deny IP rules not working (bugreport:2632).ai4rei1-3/+2
- Fixed 'mask' being filled with 'ip' when standard mask was specified (since r9647). - Fixed 'ip' and 'mask' (bit mask) being stored in wrong byte order (network order instead of host order) (since r10162). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14683 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-12-02* Added an error message when a client connection exceeds the socket write ↵ai4rei1-0/+1
buffer, so that it does not appear to be closed for no apparent reason (follow up to r13469). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14546 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-11-25* Too large client packets, which would otherwise cause the client to crash, ↵ai4rei1-0/+12
are now dropped and reported (bugreport:4391). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14503 54d463be-8e91-2dee-dedb-b68131a5f0ec
2009-02-20* Modified WFIFOSET to trigger a fatal error when trying to send a packet ↵FlavioJS1-1/+9
that is too big. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13539 54d463be-8e91-2dee-dedb-b68131a5f0ec
2009-01-21* Added a limit of 1MB of pending data in the write fifo for non-server ↵FlavioJS1-1/+11
sockets. Connections that go over the limit are closed. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13469 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-06-16* Made the socket limit not be set in cygwin, which has bogus behavior. ↵FlavioJS1-2/+9
(bugreport:1684) * Made the socket limit be set to the maximum allowed value when setting to FD_SETSIZE fails. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12839 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-06-09* Added experimental code to set the socket limit at runtime.FlavioJS1-0/+21
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12803 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-04-21* Changed the data field of timers from int to intptr.FlavioJS1-1/+1
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12633 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-02-27Altered socket code to do a graceful connection shutdown when exiting.ultramage1-3/+2
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12251 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-02-22* Removed code in socket.c that tries to avoid send buffer overloading, as ↵ultramage1-12/+0
there is a scenario (many players and charserver disconnect) where mass char saving produces huge ammounts of data to send (see r11503) * Cleaned up player respawning code (bugreport:1022) * Increased the max amount of different autocast skills from 5 to 10 * Added a missing function declaration, for real this time (followup to r12229) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12232 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-02-19* Forgotten update to the definition of script command 'input'.FlavioJS1-0/+1
* Enabled DEBUG_MEMMGR only in DEBUG mode. * Made autotrading characters be kicked instead of reporting double login. * Made create_session initialize session_data to NULL. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12218 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-02-17Reverting r12212. As expected, Linux is incompatible.ultramage1-0/+6
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12213 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-02-17Made unix interface enumeration work with dynamic sockaddr lengths (BSD, for ↵ultramage1-4/+0
example). Complain if it doesn't compile. (bugreport:765) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12212 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-02-03Added a missing client update when the mute status is manually cancelled by a GMultramage1-1/+1
(followup to r12079) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12169 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-01-29- Cleaned socket.c to use flag.server when detecting inter-server connections.skotlex1-14/+5
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12147 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-01-06Modified showmsg code to not attach a timestamp to MSG_NONE-type messages, ↵ultramage1-6/+6
generated by ShowMessage(). It now works exactly like printf(). Removed/replaced all printf calls in the code. Added a new flag to setting 'console_silent', for filtering debug messages. Silenced the "Broken pipe found" and "Server running in debug mode" messages. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12020 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-12-27* Tweeked the declaration and initialization defines for vectors.FlavioJS1-2/+4
* Made do_sockets leave the for loop as soon as the readable number of sockets returned by select is found. * Made all posix compliant systems that support it and FreeBSD >= 5.1 (implements it but doesn't have the posix defines) use the precise and consistent tick() implementation. * Minor tweek to HEAP_SEARCH (same variable can be used in from and to). * Fixed the map server not exiting when make_listen_bind fails and returns -1. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11983 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-12-17* Added flag.server to indicate interserver socketsultramage1-11/+11
- replaces the previous way (setting 'client_addr' to 0) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11930 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-12-13* Abstracted the windows socket code so that all fd's are in the range ↵FlavioJS1-92/+244
[1,FD_SETSIZE[. (bugreport:604) - The socket of a fd is forgotten when executing sClose, so things that depend on the socket (like sFD_CLR) must be executed before closing. * Replaced the fd_set of the short list with a custom implementation (works like the linux fd_set). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11897 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-12-10- The interserver outgoing buffer now gets flushed when it reaches 512KB of ↵skotlex1-1/+6
data stored on it. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11886 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-09Fixed socket.c using time() incorrectly, causing stall timer ↵ultramage1-3/+3
desynchronization (bugreport:394) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11702 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-10-31* Added names to the SC_ and SI_ enums, now they can be used to properly ↵ultramage1-3/+3
indicate where such values are to be used (replaces usage of 'int') * removed MIN_/MAX_PORTAL_MEMO, set MAX_MEMOPOINTS from 10 to 3 * removed support for @go-ing to your memo points * simplified the overly verbose @memo command; now re-uses pc_memo() * cleaned up pc_memo(), now uses semi-correct packet replies * Minor code cleaning/formatting git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11625 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-10-24* Cleaned up some messy guild code (more to come)ultramage1-1/+1
* Cleaned up the mail code, no more pointless dynamic allocation * Added upgrade_svn11548.sql to convert the mail table to new format * Updated vs7 and vs6 project files * Increased the max. send buffer size to 5M since 1M is not enough * Please complain if something stops working ^^; git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11571 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-10-21Fixed a small mistake in r11503 causing a fatal error&exit on unix when you ↵ultramage1-4/+4
try to do a graceful exit (by ctrl+c for example) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11538 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-10-18* Removed commented-out code for check_fake_id()ultramage1-2/+0
* Merged improved/cleaned up (WiP) code for clif_parse_WisMessage * Removed the requirement to provide a character name in the message string when calling is_atcommand() (needed for the previous fix) - currently both ways work, but old will be removed in the upcoming command cleanup so please adjust your custom code if you use this! * Added clif_process_message(), an unified way to validate all four types of player message packets and retrieve their components * Applied the new checking function to clif code, this fixes various length mismatches caused by incomplete code in r11386 (bugreport:198) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11507 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-10-17* Merged do_sendrecv() and do_parse() into do_sockets()ultramage1-108/+85
* Fixed subnet check message displaying incorrect ip addresses * client_addr will now be properly set to 0 for server connections * Removed socket code that attempts to cope with code bugs at runtime * Removed outdated copyright and version number from startup logo git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11503 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-10-17Using predefined constants as parameters to the exit() function.ultramage1-6/+6
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11501 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-09-20* Merged the tmpsql branch:FlavioJS1-6/+7
- Abstraction for the sql code (sql.c/h). - New configure script and makefiles. - Restored txt zeny logging code. (r10814) - Rewrote mapserver's sql code - itemdb, mobdb, mapreg, logs. (r10814) - Fixed a precedence issue (&& and ) in char_sql/char.c. (r10833) - Improved db reading code a bit for consistency. (r11077) - Added separate atcommand for mail deletion. (r11077) - Corrected a few messages that said "new" instead of "unread". (r11077) - Broadcast (*) messages now use "*" as the target's name (not ""). (r11077) - Moved StringBuf code from utils.c/h to strlib.c/h. (r11084 r11117) - Some misc login server cleanups (reformatting etc). (r11136) - Corrected/modified some header entries. (r11141 r11147 11148) - Adjusted VS project files. (r11147) - Adjusted the way the sql charserver does item saving. (r11192) - Corrected usage of reserved keyword 'friend' in mmo.h. (r11192) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11245 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-07-25* Added support for character rename packet (only dummy code for now)ultramage1-2/+2
* Added support for langtype-12 char deletion packet (tested, works) * Synchronized txt/sql charserver code a bit * Adjusted motd.txt to not crash new clients * Removed some dead code from the charserver (see r352) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10909 54d463be-8e91-2dee-dedb-b68131a5f0ec