59 Commits

Author SHA1 Message Date
ultramage
0bbf505d59 * Merged do_sendrecv() and do_parse() into do_sockets()
* 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://svn.code.sf.net/p/rathena/svn/trunk@11503 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-10-17 20:24:48 +00:00
FlavioJS
65642f6f1c * Merged the tmpsql branch:
- 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://svn.code.sf.net/p/rathena/svn/trunk@11245 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-09-20 11:09:36 +00:00
FlavioJS
f3bb9a322d * RFIFOREST returns 0 when the session is eof (input data is implicitly discarted).
* Reworked the player fame update:
- would crash if an invalid pos was received
- the wrong player could be updated on certain conditions

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@10640 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-05-28 18:25:32 +00:00
ultramage
9e7eb8804f - Removed the TURBO socket mechanism - it was in fact just using a variable to cache a few arithmetic operations (premature optimization)
- Since the fifohead mess is gone, fixed leftover bad code structuring

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@10599 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-05-21 18:40:29 +00:00
FlavioJS
82b3153800 * Adapted the shortlist to use a static array instead of a linked list and enabled it.
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@10507 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-05-09 04:24:33 +00:00
FlavioJS
71f29c0445 * Added Buuyo-Tama's shortlist for send/eof sockets (defined out for now).
* Replaced toupper/tolower in ladmin by TOUPPER/TOLOWER defines.

Shortlist:
It's a list of sockets that have data to send and/or are ready for eof processing.
It aims to reduce the amount of time spent on do_sendrecv, where it was spending ~13.5% of execution time on a server with 1k users at WoE.
thanks to Buuyo-tama for the profile info and code

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@10506 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-05-09 03:18:16 +00:00
FlavioJS
bc088a5ad8 * Removed the dependency on winsock.h for definitions, it's all winsock2.h now.
* Minor documentation/re-coding in chat.c.
* More work on ticket #41.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@10471 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-05-05 14:50:07 +00:00
ultramage
833fd942a4 * Tried and fixed md5 password encryption
- login_sql was doing stupid things like re-using one pre-generated key for all connections, and escaping binary md5 data (destroying it)
- added missing code to login_txt when creating new accounts, showing that storing passwords as md5 hashes never really worked for txt
- removed PASSWORDENC's conditional compilation effect, now just a flag
- greatly simplified md5 password checking code, credits to eapp
* login server will now bind only after finishing the init phase

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@10384 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-04-28 14:34:58 +00:00
ultramage
b1ccbcdba7 - Added ntows() to properly handle that client port number deficiency
- Adjusted the packet_db array for a more consistent look
- Reorganized some entries in packet_db.txt
- Fixed a small scripts_custom.conf typo

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@10296 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-04-20 21:57:33 +00:00
toms
9f6d32d8de Removed an ugly cast in socket.c
Fixed Makefile (-Wno-unused-parameter was added twice with gcc4)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@10205 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-04-10 14:34:04 +00:00
ultramage
24db1473f4 - Added function str2ip() to do platform-safe conversions
- Removed a bunch of unused stuff
- Moved SIGILL to unix-only defines since tests and docs show that Windows doesn't issue SIGILL
- Fixed several annoying compilation warnings

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@10177 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-04-07 12:06:25 +00:00
ultramage
8dc1b77f03 * Made a crazy attempt to at least partially synchronize login&char code
* Major edit to the way the servers handle ip addresses, making them obey the "host byte order inside, network byte order outside" rule
- hopefully covered all entry- and exit-points for IP address data
- discovered several places where Gravity's client breaks the convention, will need to come up with a suitable countermeasure for that
- other than that, the code should be portable, except for printing and ipban mask testing (those still assume a specific byte order)
- tested both txt and sql in all usual situations; tested single- and multi-server setups, all seems to work (but watch out for hidden bugs!)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@10162 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-04-05 18:49:57 +00:00
ultramage
a167b6ae62 * Some source code cleaning
- Fixed the badly worded messages during mapserver startup
- Cleaned up socket config reading
- Split resolve_hostbyname() into 2 separate functions for clarity
- Moved the probably obsolete LOWER/UPPER macros to db.c (TODO: remove)
- Moved the badly placed compare_item() function to storage.c (see r779)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@10119 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-04-02 13:46:11 +00:00
FlavioJS
2b42ec13cf - Added info on packet 0x86 (simple move packet). Not usable until a clear separation between entering sight/leaving sight/walking in sight is done.
- Propagating const char* from the script engine.
- ".gat" is appended to the map name before sending the changemapserver packet to the client.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9979 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-03-09 01:49:50 +00:00
skotlex
a0bfff19a1 - Removed delete_session from socket.h since it shouldn't be used by them.
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9955 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-03-04 22:51:22 +00:00
ultramage
5625383530 More tweaks to socket.c to simplify the code
- many generic cleanups - reformatting, useless code removal, etc
- made the mode_neg setting a compile-time decision, not a run-time one
- removed the silly frame_size setting (there since r1)
- added some TODOs to http://www.eathena.ws/board/index.php?showtopic=127988

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9954 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-03-04 21:06:28 +00:00
ultramage
49096125fb Applied a consistent look to all header files (copyright, ifdefs)
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9891 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-02-21 15:09:20 +00:00
ultramage
1aa9c5ceca - Fixed the new socket code, which was triggering the inactivity timeout on the servers' listening sockets
- Fixed the TURBO code not working since r4468 (parse func never called)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9826 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-02-08 16:36:48 +00:00
ultramage
0729d61b56 * More aggressive cleaning up of the socket code
- removed unused session_data2 entry in sd
- added a new create_session() function, helps keep things cleaner (although it's ad-hoc and not perfect, since this is C)
- undid r4978 since it was getting in the way (re-add it if you need it)
- added defines for the recv, send and parse func pointers
- added null functions for the three actions, and made create_session() calls use those instead of NULL pointers; insignificant penalty and now:
- since all three funcs are always initialized, removed all those NULL checks 
- removed the efd set, since as the people from the developernet forums pointed out, it's only for out-of-band data and NOT for error checking (in fact, select() bails out without giving any info if it errors out)
- reorganized the randomly placed socket.c contents somewhat

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9822 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-02-08 01:33:40 +00:00
ultramage
3e4bef37b7 Wiped out the poorly written parse code from r2211
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9819 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-02-07 20:30:22 +00:00
ultramage
148f3fca88 Cleaning up of the socket code
- Shuffled includes around for files that were leeching off of socket.h
- Added code that enforces standard shutdown behavior for sockets

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9817 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-02-07 19:34:54 +00:00
FlavioJS
c46f3cf135 - Removed deprecated console code.
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9815 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-02-07 06:25:00 +00:00
FlavioJS
a7ee9a9961 - Cleaned up the ip rules/DDoS section of the code. (the allow,deny and deny,allow cases were switched)
- Updated the information about ip rules and DDoS protection in packet_athena.conf and commented out the line "allow: all" so connections are rejected when a DDoS is detected.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9647 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-01-12 13:51:38 +00:00
FlavioJS
db02576357 - Now winsock 2 is required.
- Cleaned up do_close and socket_init a bit.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9621 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-01-06 12:11:50 +00:00
FlavioJS
63c6008744 ups... forgot to remove this before committing
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9612 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-01-03 12:03:22 +00:00
FlavioJS
129bff5fb6 - Fixed FIFO defines in TURBO mode.
Ref: http://www.eathena.ws/board/index.php?showtopic=129766
  The rest of the TURBO related errors are about the HEAD defines having to be at the start of a block because they contain a variable declaration. (i won't fix these)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9611 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-01-03 12:01:43 +00:00
skotlex
58bb9be68a - Cleaned up some more the code so it works for -DTURBO
- Cleaned the pvpoff @ and script commands.
- mob_get_random_id now has two additional flags to specify that the monster to acquire should not be a boss type (4) or that it should give exp (8).
- TK_MISSION will now pick any mob from the DB as long as it is not a boss type and it gives base exp.
- Fixed the double-stone issue when hitting a petrified character.
- Minor cleanups


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9573 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-12-26 15:07:18 +00:00
FlavioJS
60e3d1b499 - Applied part 1 of TheUltraMage's socket cleanup.
"Basically what I did was perform simple one-liner substitutions for ugly repetitive blocks of code. The most apparent are the send/recv code and the other basic socket calls."
- flush_fifo is non-blocking now. I guess best effort is good enough...
- Copied header files from vcproj-7.1 files to vcproj-8 files.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9570 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-12-25 06:59:25 +00:00
FlavioJS
43256aa77e - Cleanups or minor changes.
- Now addtick_timer invokes settick_timer, so keep an eye for whatever timer issues it's supposed to have.
- Removed the flush_fifo from clif_parse_TickSend until the socket problems are fixed.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9521 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-12-19 09:15:00 +00:00
skotlex
0c362fa90f - Modified flush_fifo so you can decide whether to block the current thread or not until the data is sent. The server-tick reply no longer blocks the current thread.
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9486 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-12-13 13:45:52 +00:00
FlavioJS
b524f75cd0 - Reversed revision #9415 (messages with server_tick field being sent as soon as possible) since it didn't fix the client synchronization issue.
- clif_parse_TickSend is sent immediately so the client gets accurate "pings"

Note: in Changelog, for my changes, if they're grouped together and in the same day I'm only gonna "sign" the bottom line.
All unsigned lines are assumed to be from the same person of the previous line (below). (easier searches =P)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9443 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-12-09 15:57:22 +00:00
FlavioJS
0931ce5d81 - Messages with server_tick field are sent as soon as possible now.
This might fix client synchronization issues.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9415 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-12-06 10:57:31 +00:00
FlavioJS
b522ca0cdc - Replaced @send with the version I use for testing packets.
Can display the packet length. Supports dynamic packets, quoted strings 
  with escaped characters and fixed/variable length, and normal/hex 
  byte/word/long data types. The number of fields is not limited, but it 
  automatically stops parsing when the packet is full.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9387 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-12-02 04:21:35 +00:00
FlavioJS
636089bb3a - Probably fixed the Segmentation Faults we've been having.
Description: A player quits and it's session is freed and set to NULL, 
       but the char server already sent a packet with player information 
       (registers, storage, ...). If a message is sent in consequence of 
       updating that info, a segmentation fault happens because 
       session[sd->fd] is already NULL.
  Fix: make shure the session of the target player is valid before 
       processing the rest of the char server's message.
- Some minor cleanups.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9366 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-11-29 20:07:22 +00:00
skotlex
cfee0ccf63 - Added all the missing FIFOHEADs in the login/sql servers (required for TURBO support)
- Fixed the fact that the TURBO code breaks when you attempt to handle more than one connection at a time within the same function. However this broke map-server compilation, therefore, don't use TURBO yet! It needs more fixing (and I need more time to fix it)
- While at it, cleaned a few packet implementations in the char/login servers which were not only ugly, but had some really stupid flaws within (stuff like escaping a string, and then using the non-escaped variable to insert to SQL? T_T) And will someone explain me why the TXT servers are coded much more cleanly, and without such horribly broken code as I find in the SQL ones? T_T;


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9307 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-11-24 12:41:38 +00:00
skotlex
73379857e2 - Made WFIFOHEAD() check for available buffer size remaining on the connection, and when there's not enough space, it will increase it.
- Added define TURBO to the Makefile. It enables MouseJstr's socket access optimization which should speed up the code when accessing the write/read buffers repeatedly within a function.
- Fixed the functions where the RFIFOHEAD/WFIFOHEAD functions were used incorrectly (prevents TURBO enabled compilations from finishing)


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9297 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-11-23 15:33:51 +00:00
skotlex
c616fec871 - Improved a bit RFIFOFLUSH as suggested by Harbin.
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@8838 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-09-21 19:10:31 +00:00
skotlex
27c9a6fe5a - Modified set_nonblocking and setsocketoptions in socket.c, using eApp's code as reference. Hopefully should improve performance somewhat.
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@8710 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-09-11 21:32:26 +00:00
Lance
26500644dd * Optional macro MEMSET_TURBO for faster low-level memory initializations.
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@8499 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-08-27 06:38:17 +00:00
skotlex
4d27716bf1 - Tested and fixed resolve_hostbyname.
- Applied said function around most of the code where needed. Removed includes for the OS/network system pretty much from every file (our socket.c file should handle this)
- Added clif_getip_long, which returns the ip as a long. Prevents having to include the files to define the int_addr structure in all files that include clif.h
- Made the GM mute request bypass the manner_system setting.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@7285 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-06-22 01:12:52 +00:00
skotlex
84cdde2a88 - Whoops, somehow socket.h wasn't udpated correctly -.-
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@7282 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-06-21 18:35:31 +00:00
skotlex
847d853332 - Added function parse_hostbyname() which takes a hostname and a char[4]. The hostname is resolved to an ip, whose individual components are stored in char[], the return value of the function is the inet_addr result of the lookup (or returns 0 when failed). Meant to be used in the rest of the code without the need to do socket/network related includes.
- Applied use of parse_hostbyname() in chrif.c to fix compilation errors.
- status_percent_change will now account for when the target's max hp/sp is above INT_MAX.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@7281 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-06-21 18:30:39 +00:00
skotlex
d72c881051 - Removed typedef bool from socket.h and included cbasetypes.c instead.
- Cleaned up and corrected the calculation of hit/flee/cri/lucky dodge in status_calc_bl.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@6890 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-31 14:06:22 +00:00
Valaris
2178a86317 AS OF SVN REV. 5901, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.  EVERYTHING ELSE
GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@5094 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-01-29 16:10:48 +00:00
Valaris
fd99753f8e Clearing trunk.
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@5091 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-01-29 16:00:45 +00:00
amber
83500a3c58 Finished native SQL projects [MouseJstr]
git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@1351 54d463be-8e91-2dee-dedb-b68131a5f0ec
2005-03-31 04:02:06 +00:00
amber
c8d5eb58c4 Fix linux builds
git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@1340 54d463be-8e91-2dee-dedb-b68131a5f0ec
2005-03-30 01:17:30 +00:00
veider
7a6ae3f0e6 git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@1339 54d463be-8e91-2dee-dedb-b68131a5f0ec 2005-03-29 21:51:46 +00:00
celest
61c4e01a71 * Updated jA's dummy socket to mod1137
* Added jA's ddos protection system
* Moved stall_time's reading to packet_athena.conf

git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@1237 54d463be-8e91-2dee-dedb-b68131a5f0ec
2005-03-16 12:21:26 +00:00
celest
311621f308 * Added jA's dummy socket to prevent fd crashes
git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@1183 54d463be-8e91-2dee-dedb-b68131a5f0ec
2005-02-26 08:38:22 +00:00