Author Topic: 0.4.1.2e  (Read 11836 times)

0 Members and 1 Guest are viewing this topic.

Offline PPK

  • Administrator
  • Emperor
  • *****
  • Posts: 1 475
  • Karma: +209/-22
  • PtokaX developer
0.4.1.2e
« on: 06 February, 2011, 03:52:30 »
Windows version with GUI: http://www.PtokaX.org/files/0.4.1.2e.7z
Windows x64 version with GUI: http://www.PtokaX.org/files/0.4.1.2e-x64.7z
Windows service: http://www.PtokaX.org/files/0.4.1.2e-service.7z
Windows x64 service: http://www.PtokaX.org/files/0.4.1.2e-service-x64.7z
Source for unix systems: http://www.PtokaX.org/files/0.4.1.2e-nix-src.tgz


Quote from: Changes
Added: Column sorting to registered users list in registered users frame.
Added: Filter to registered users frame.
Added: Missing maximize icon to script editor window.
Added: Registered users window.
Fixed: Crash when script throw error on startup (thx TiMeTrAVelleR for report).
Fixed: Possible memory leak in script editor on script loading.

"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

PtokaX forum

0.4.1.2e
« on: 06 February, 2011, 03:52:30 »

Offline P_pan

  • Fulll Member
  • ****
  • Posts: 71
  • Karma: +1/-3
Re: 0.4.1.2e
« Reply #1 on: 06 February, 2011, 10:09:47 »
great job PPK!  thank you!

Offline mariner

  • Member
  • ***
  • Posts: 25
  • Karma: +2/-5
    • [K.lan]Project (now tested)
Re: 0.4.1.2e
« Reply #2 on: 06 February, 2011, 13:56:41 »
Great job, PPK, but when do you fix your spaghetti code? For example:
Code: [Select]
hashBanManager.cpp:249 uint16_t ui16dx = ((uint16_t *)&Ban->ui32IpHash)[0];This code doesn't work on big-endian architectures. And it's fails with strict-aliasing (O2 level in g++)
« Last Edit: 06 February, 2011, 13:58:46 by mariner »
Eat my bolts, bastard... ? member of Devaster Squad

sudo ./configure_brain.sh

Offline PPK

  • Administrator
  • Emperor
  • *****
  • Posts: 1 475
  • Karma: +209/-22
  • PtokaX developer
Re: 0.4.1.2e
« Reply #3 on: 06 February, 2011, 19:54:33 »
I don't have any big-endian arch for testing, so it is hard to fix something for that ::) And PtokaX don't use O2, so i have nothing to fix :P And when you want to call something as "spaghetti code" then first read what spaghetti code is  8)
« Last Edit: 06 February, 2011, 20:05:50 by PPK »
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

Offline PPK

  • Administrator
  • Emperor
  • *****
  • Posts: 1 475
  • Karma: +209/-22
  • PtokaX developer
Re: 0.4.1.2e
« Reply #4 on: 07 February, 2011, 01:58:55 »
I'm miss that code is related to ip hashtable... in future (maybe this year) will be added tcp/ip v6 support, and for that all ip related things will be rewritten :D
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

Offline mariner

  • Member
  • ***
  • Posts: 25
  • Karma: +2/-5
    • [K.lan]Project (now tested)
Re: 0.4.1.2e
« Reply #5 on: 07 February, 2011, 11:50:01 »
With O2 level PtokaX work faster.  I think, that's is better, then O0 level. You can fix this error easy.
Code: [Select]
hashBanManager.cpp:249 uint16_t ui16dx = (uint16_t ) Ban->ui32IpHash; This code don't fails on O2 and O3 levels and works on big-endian arch. Keep it simple.
Eat my bolts, bastard... ? member of Devaster Squad

sudo ./configure_brain.sh

Offline PPK

  • Administrator
  • Emperor
  • *****
  • Posts: 1 475
  • Karma: +209/-22
  • PtokaX developer
Re: 0.4.1.2e
« Reply #6 on: 07 February, 2011, 15:02:05 »
PtokaX can't work faster with O2. Test with performance profiler show that most time is used in send and recv socket function. Higher optimization level can't make that faster ::)
I can't test if is really not working on big-endian, i don't see any reason why this code should fail. Number will be different, but that should be all :o
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

Offline mariner

  • Member
  • ***
  • Posts: 25
  • Karma: +2/-5
    • [K.lan]Project (now tested)
Re: 0.4.1.2e
« Reply #7 on: 07 February, 2011, 20:08:58 »
But this code fail. On b-e arch you code will take other part of numeric variable. So, if you have Ban->ui32IpHash less then 65536, you will have zero in ui16dx.  On the l-e arch you will have value of Ban->ui32IpHash  in  ui16dx (if value less then 65536). Read about big-endian.
Eat my bolts, bastard... ? member of Devaster Squad

sudo ./configure_brain.sh

Offline PPK

  • Administrator
  • Emperor
  • *****
  • Posts: 1 475
  • Karma: +209/-22
  • PtokaX developer
Re: 0.4.1.2e
« Reply #8 on: 08 February, 2011, 05:15:15 »
So, if you have Ban->ui32IpHash less then 65536, you will have zero in ui16dx.
And that is perfectly acceptable for me, because lower than 65536 are ip addresses below 0.1.0.0 :P That is not fail, that is how it works ;)
« Last Edit: 08 February, 2011, 15:19:49 by PPK »
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

Offline Snooze

  • Scripter
  • Viking
  • ******
  • Posts: 606
  • Karma: +54/-3
    • DiXBoT Website
Re: 0.4.1.2e
« Reply #9 on: 11 February, 2011, 09:18:42 »
Hi PPK,Will you be making x64 libs available for the x64 build as well?Libs I'm interested in:- lfs- socket- sqliteThanks,Snooze

Offline PPK

  • Administrator
  • Emperor
  • *****
  • Posts: 1 475
  • Karma: +209/-22
  • PtokaX developer
Re: 0.4.1.2e
« Reply #10 on: 11 February, 2011, 18:40:20 »
Why me ? ::) Source for libs is available. Visual studio express is free download on ms site. I have better things to do than compile libs.
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

Offline mariner

  • Member
  • ***
  • Posts: 25
  • Karma: +2/-5
    • [K.lan]Project (now tested)
Re: 0.4.1.2e
« Reply #11 on: 14 February, 2011, 05:56:57 »
Dear PPK, compile this code and test it. You will have equal result
Code: [Select]
#include <iostream>
#include <stdint.h>

using namespace std;

int main() {
uint32_t a;
uint16_t b, c;
cout << "Insert the value: " << endl;
cin >> a;
b = (uint16_t) a;
c = ((uint16_t *)&a)[0];
cout << "Mariner code result: " << b << endl << "PPK code result: " << c << endl;
return 0;
}
Now about compilation
Quote
gyrt ~ % g++ -O0 -Wall -Wextra test.cpp -o test                            9:09
gyrt ~ % ./test                                                            9:09
Insert the value:
65500
Mariner code result: 65500
PPK code result: 65500
gyrt ~ % ./test                                                            9:10
Insert the value:
65536
Mariner code result: 0
PPK code result: 0
gyrt ~ % ./test                                                            9:10
Insert the value:
65537   
Mariner code result: 1
PPK code result: 1
gyrt ~ % g++ -O1 -Wall -Wextra test.cpp -o test                            9:10
gyrt ~ % ./test                                                            9:10
Insert the value:
65500
Mariner code result: 65500
PPK code result: 65500
gyrt ~ % ./test                                                            9:10
Insert the value:
65536
Mariner code result: 0
PPK code result: 0
gyrt ~ % ./test                                                            9:11
Insert the value:
65537
Mariner code result: 1
PPK code result: 1
gyrt ~ % g++ -O2 -Wall -Wextra test.cpp -o test                            9:11
test.cpp: In function ?int main()?:
test.cpp:12: warning: dereferencing type-punned pointer will break strict-aliasing rules
test.cpp:12: warning: dereferencing pointer ?a.60? does break strict-aliasing rules
test.cpp:12: note: initialized from here
gyrt ~ % ./test                                                            9:11
Insert the value:
65500
Mariner code result: 65500
PPK code result: 65500
gyrt ~ % ./test                                                            9:11
Insert the value:
65536
Mariner code result: 0
PPK code result: 0
gyrt ~ % ./test                                                            9:11
Insert the value:
65537
Mariner code result: 1
PPK code result: 1
gyrt ~ % ./test                                                            9:11
Insert the value:
67000
Mariner code result: 1464
PPK code result: 1464
So, you can see, that your code fails, when we use optimizations. Futhermore, after optimization didn't work some LUA API functions.

Why do you use difficult code instead of simple?
« Last Edit: 14 February, 2011, 07:15:57 by mariner »
Eat my bolts, bastard... ? member of Devaster Squad

sudo ./configure_brain.sh

Offline PPK

  • Administrator
  • Emperor
  • *****
  • Posts: 1 475
  • Karma: +209/-22
  • PtokaX developer
Re: 0.4.1.2e
« Reply #12 on: 14 February, 2011, 12:50:08 »
Where it's that fail  ??? In all cases it is giving same values, or i'm missing something ?
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

Offline mariner

  • Member
  • ***
  • Posts: 25
  • Karma: +2/-5
    • [K.lan]Project (now tested)
Re: 0.4.1.2e
« Reply #13 on: 14 February, 2011, 18:37:42 »
PtokaX fails when we use flag -O2 with your code. If I use simple code from my example - ptokax works correctly. I can send you 2 binaries, compiled on Debian and you can test it.
Eat my bolts, bastard... ? member of Devaster Squad

sudo ./configure_brain.sh

Offline PPK

  • Administrator
  • Emperor
  • *****
  • Posts: 1 475
  • Karma: +209/-22
  • PtokaX developer
Re: 0.4.1.2e
« Reply #14 on: 14 February, 2011, 22:49:59 »
As you show with your example there is no fail with -O2 and your code is giving same result as my code. All what you do was wasting my time. So if you don't show any fail i will not reply to you anymore...
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

Offline sphinx_spb

  • Member
  • ***
  • Posts: 47
  • Karma: +10/-3
Re: 0.4.1.2e
« Reply #15 on: 19 February, 2011, 13:41:33 »
Dear mariner, if you would create hub-soft better than Ptokax (i.e. more reliable, stable, maybe even without spaghetti) - I would take off my hat.
Until that, your claims looks miserable.

update:
you can also modify sources, they're still open.
« Last Edit: 19 February, 2011, 13:44:48 by sphinx_spb »

Offline PPK

  • Administrator
  • Emperor
  • *****
  • Posts: 1 475
  • Karma: +209/-22
  • PtokaX developer
Re: 0.4.1.2e
« Reply #16 on: 19 February, 2011, 15:07:39 »
you can also modify sources, they're still open.
And that is his problem, he changed source. He switched compiler mode to complainer and bad things happen ::)
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

Offline mariner

  • Member
  • ***
  • Posts: 25
  • Karma: +2/-5
    • [K.lan]Project (now tested)
Re: 0.4.1.2e
« Reply #17 on: 20 February, 2011, 16:20:00 »
Quote
he changed source
With out change ptokax lua api works bad.

Check this archive. This is PtokaX for x86_32 Linux.
Code: [Select]
~/PtokaX % gcc -v                                                                                               
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.2.4 (Ubuntu 4.2.4-1ubuntu4)
Code: [Select]
~/PtokaX % dpkg -l G libc6
ii  libc6                                 2.7-10ubuntu8                      GNU C Library: Shared libraries
ii  libc6-dev                             2.7-10ubuntu8                      GNU C Library: Development Libraries and Hea
ii  libc6-i686                            2.7-10ubuntu8                      GNU C Library: Shared libraries [i686 optimi
In the archive you can see a script, wich send a message if you is an unregistred user. So I register user. On standart PtokaX i have no notification after I connected as registred user. After that I start PtokaX compiled with -O2 flag. And after I connected to hub I see a message for unregistred user. So after that I run a PtokaX compiled with my changes in the code. And bot didn't send any notifications for unregistred user.

PS and little forum bag  :P
Quote
PtokaX.tar.gz.
You cannot upload that type of file. The only allowed extensions are jpg,gif,png,lua,rar,7z,zip,tar.gz.
« Last Edit: 20 February, 2011, 16:23:19 by mariner »
Eat my bolts, bastard... ? member of Devaster Squad

sudo ./configure_brain.sh

Offline PPK

  • Administrator
  • Emperor
  • *****
  • Posts: 1 475
  • Karma: +209/-22
  • PtokaX developer
Re: 0.4.1.2e
« Reply #18 on: 20 February, 2011, 16:39:11 »
With out change ptokax lua api works bad.
And nobody noticed it in 3 years ?
On standart PtokaX i have no notification after I connected as registred user. After that I start PtokaX compiled with -O2 flag. And after I connected to hub I see a message for unregistred user.
First you wrote that without change lua api works bad. Second you wrote that without change it works ok.
For me it works ok, even when that script is crap.
Code: [Select]
function UserConnected(user)
if tCfg.ShowToUnreg and not RegMan.GetReg(user.sNick) then
ToUser(user,tMsg.Unreg)
end
UserMenu(user)
end

OpConnected = UserConnected
RegConnected = UserConnected

This is very bad scripting style, way how to cause PtokaX using much more cpu than is needed. Is should be something like:

Code: [Select]
function UserConnected(user)
if tCfg.ShowToUnreg then
ToUser(user,tMsg.Unreg)
end
UserMenu(user)
end

function OpConnected(user)
    UserMenu(user)
end
function RegConnected(user)
    UserMenu(user)
end
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

Offline mariner

  • Member
  • ***
  • Posts: 25
  • Karma: +2/-5
    • [K.lan]Project (now tested)
Re: 0.4.1.2e
« Reply #19 on: 21 February, 2011, 08:05:31 »
Quote
First you wrote that without change lua api works bad. Second you wrote that without change it works ok.
Without change I cannot compile ptokax with -O2 option. I upload an archive with 3 different binaries.
PtokaX_standart - ptokax from source without any changes.
PtokaX_O2 -  compiled with this g++ flags  -O2 -fomit-frame-pointer -fstack-protector
PtokaX_modified - PtokaX with changes source and compiled with g++ flags  -O2 -fomit-frame-pointer -fstack-protector

PtokaX_standart: Lua API works good but has no optimizations.
PtokaX_O2: PtokaX works faster, but has problems with lua API.
PtokaX_modified: Lua API works good and has some optimizatoins.

Just test it!

Why didn't you want to change code with warnings? I don't understand it. Futhermore, O2-option is a standart flag in many Linux Dists.
Eat my bolts, bastard... ? member of Devaster Squad

sudo ./configure_brain.sh

Offline PPK

  • Administrator
  • Emperor
  • *****
  • Posts: 1 475
  • Karma: +209/-22
  • PtokaX developer
Re: 0.4.1.2e
« Reply #20 on: 21 February, 2011, 16:43:00 »
PtokaX compiled from my source don't show any warning (i'm compiled 0.4.1.2e on debian lenny and debian squeeze before release). PtokaX compiled from my source is working correctly (you wrote that multiple times). If you don't want problems then don't modify my source. Source was released to allow users to compile PtokaX on theyr os, not to allow them to modify it and then complains that it is not working correctly because they are stupid and change something that they shouldn't >:( And no, PtokaX is not working faster with -O2, because when he is working faster (as old 0.3.3.x versions), then big hubs can't run on it (faster data sending -> PtokaX will use all upload on startup when is sending userlist to new users -> when all upload is used then many users is disconnected randomly -> they connect again -> again all upload is used -> again drop... neverending story with bad end).

When you want lower cpu usage, then use better scripts. Not crap like that one from your archive :-X
« Last Edit: 21 February, 2011, 16:44:43 by PPK »
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

Offline bastya_elvtars

  • Forum God
  • ****
  • Posts: 3 725
  • Karma: +173/-7
  • The rock n' roll doctor
    • The FreshStuff3 Site
Re: 0.4.1.2e
« Reply #21 on: 21 February, 2011, 19:25:51 »
I think anyone can contribute patches. It is however better to have conversations in a nice manner, unlike the first comment regarding this spaghetti stuff. Oh and nice snippet, American Idiot. ;-)
Everything could have been anything else and it would have just as much meaning.

Offline mariner

  • Member
  • ***
  • Posts: 25
  • Karma: +2/-5
    • [K.lan]Project (now tested)
Re: 0.4.1.2e
« Reply #22 on: 24 February, 2011, 09:25:54 »
It's my last proof for PPK. This is test programm, compiled on mips (be arch). System - debian lenny
Eat my bolts, bastard... ? member of Devaster Squad

sudo ./configure_brain.sh

Offline PPK

  • Administrator
  • Emperor
  • *****
  • Posts: 1 475
  • Karma: +209/-22
  • PtokaX developer
Re: 0.4.1.2e
« Reply #23 on: 24 February, 2011, 14:45:55 »
Proof that it is working correctly. And you always don't understand how it is working :-X
Is really simple. On little ending it is getting number from second part of ip (0.0.x.x), on big endian from first part of ip (x.x.0.0). That is how it was designed and as you show how it is correctly working  :P
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

Offline bastya_elvtars

  • Forum God
  • ****
  • Posts: 3 725
  • Karma: +173/-7
  • The rock n' roll doctor
    • The FreshStuff3 Site
Re: 0.4.1.2e
« Reply #24 on: 24 February, 2011, 18:05:40 »
There is nothing wrong with the Lua API.
 To be most efficient make as few API calls as is required.
Consider streamlining your code. For example the user.iProfile
is available in the connect arrivals, there is no need to call RegMan.

Totally agree. As a rule of thumb, make as few function calls as possible in order to have fast code. Table lookups are cheap, function calls aren't.
By the way, ain't UserConnected only called when an unregistered user enters?
Everything could have been anything else and it would have just as much meaning.

PtokaX forum

Re: 0.4.1.2e
« Reply #24 on: 24 February, 2011, 18:05:40 »