summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x[-rw-r--r--]CHAT.cpp0
-rwxr-xr-x[-rw-r--r--]CHAT.h0
-rwxr-xr-x[-rw-r--r--]CONF.cpp0
-rwxr-xr-x[-rw-r--r--]CONF.h0
-rwxr-xr-x[-rw-r--r--]HTML.cpp0
-rwxr-xr-x[-rw-r--r--]HTML.h0
-rwxr-xr-x[-rw-r--r--]MUTX.cpp0
-rwxr-xr-x[-rw-r--r--]MUTX.h0
-rwxr-xr-xMakefile107
-rwxr-xr-x[-rw-r--r--]README.txt18
-rwxr-xr-x[-rw-r--r--]SOCK.cpp0
-rwxr-xr-x[-rw-r--r--]SOCK.h0
-rwxr-xr-x[-rw-r--r--]TOOL.cpp0
-rwxr-xr-x[-rw-r--r--]TOOL.h0
-rwxr-xr-x[-rw-r--r--]base.cpp37
-rwxr-xr-x[-rw-r--r--]base.h0
-rwxr-xr-x[-rw-r--r--]chat.cpp30
-rwxr-xr-x[-rw-r--r--]chat.h0
-rwxr-xr-x[-rw-r--r--]cmnd.cpp10
-rwxr-xr-x[-rw-r--r--]cmnd.h0
-rwxr-xr-x[-rw-r--r--]conf.cpp10
-rwxr-xr-x[-rw-r--r--]conf.h0
-rwxr-xr-x[-rw-r--r--]conf.txt3
-rwxr-xr-x[-rw-r--r--]cont.cpp11
-rwxr-xr-x[-rw-r--r--]cont.h0
-rwxr-xr-x[-rw-r--r--]data.h0
-rw-r--r--gfx/CVS/Root2
-rwxr-xr-x[-rw-r--r--]gfx/y_ani_black.gifbin61100 -> 61100 bytes
-rwxr-xr-x[-rw-r--r--]gfx/y_ani_white.gifbin53536 -> 53536 bytes
-rwxr-xr-x[-rw-r--r--]glob.h10
-rwxr-xr-x[-rw-r--r--]html.cpp26
-rwxr-xr-x[-rw-r--r--]html.h1
-rw-r--r--html/CVS/Entries10
-rw-r--r--html/CVS/Root2
-rwxr-xr-xhtml/frameset.html12
-rwxr-xr-xhtml/index.html63
-rwxr-xr-xhtml/input.html48
-rwxr-xr-xhtml/notfound.html4
-rwxr-xr-xhtml/online.html18
-rwxr-xr-xhtml/stream.html43
-rwxr-xr-x[-rw-r--r--]html/y_ani.gifbin35107 -> 35107 bytes
-rwxr-xr-x[-rw-r--r--]incl.h1
-rwxr-xr-x[-rw-r--r--]main.cpp6
-rwxr-xr-x[-rw-r--r--]msgs.h11
-rwxr-xr-x[-rw-r--r--]mutx.cpp8
-rwxr-xr-x[-rw-r--r--]mutx.h0
-rwxr-xr-x[-rw-r--r--]name.cpp24
-rwxr-xr-x[-rw-r--r--]name.h0
-rwxr-xr-xpool.cpp46
-rwxr-xr-x[-rw-r--r--]reqp.cpp145
-rwxr-xr-x[-rw-r--r--]reqp.h11
-rwxr-xr-x[-rw-r--r--]room.cpp11
-rwxr-xr-x[-rw-r--r--]room.h0
-rwxr-xr-x[-rw-r--r--]sock.cpp172
-rwxr-xr-x[-rw-r--r--]sock.h18
-rwxr-xr-x[-rw-r--r--]thrd.cpp21
-rwxr-xr-x[-rw-r--r--]thrd.h0
-rwxr-xr-x[-rw-r--r--]todo.txt0
-rwxr-xr-x[-rw-r--r--]user.cpp92
-rwxr-xr-x[-rw-r--r--]user.h7
60 files changed, 284 insertions, 754 deletions
diff --git a/CHAT.cpp b/CHAT.cpp
index 1358a06..1358a06 100644..100755
--- a/CHAT.cpp
+++ b/CHAT.cpp
diff --git a/CHAT.h b/CHAT.h
index 6c015f4..6c015f4 100644..100755
--- a/CHAT.h
+++ b/CHAT.h
diff --git a/CONF.cpp b/CONF.cpp
index 8b5441c..8b5441c 100644..100755
--- a/CONF.cpp
+++ b/CONF.cpp
diff --git a/CONF.h b/CONF.h
index f3dc5c9..f3dc5c9 100644..100755
--- a/CONF.h
+++ b/CONF.h
diff --git a/HTML.cpp b/HTML.cpp
index a93bc0a..a93bc0a 100644..100755
--- a/HTML.cpp
+++ b/HTML.cpp
diff --git a/HTML.h b/HTML.h
index 16bf13d..16bf13d 100644..100755
--- a/HTML.h
+++ b/HTML.h
diff --git a/MUTX.cpp b/MUTX.cpp
index 41382f3..41382f3 100644..100755
--- a/MUTX.cpp
+++ b/MUTX.cpp
diff --git a/MUTX.h b/MUTX.h
index f2e9980..f2e9980 100644..100755
--- a/MUTX.h
+++ b/MUTX.h
diff --git a/Makefile b/Makefile
index 27a8d90..7506171 100755
--- a/Makefile
+++ b/Makefile
@@ -1,95 +1,12 @@
-MAKE=`tail -n 1 make.version`
-PREFIX=`grep "define PREFIX" src/glob.h | cut -d'"' -f2`
-all: version base modules
- @echo "Now edit the ychat.conf and run ychat!"
- @echo "The config file is searched in the following order:"
- @echo " ./ychat.conf "
- @echo " ~/.ychat/ychat.conf "
- @echo " ./etc/ychat.conf "
- @echo " /etc/ychat.conf "
- @echo " $(PREFIX)/etc/ychat.conf "
- @echo If you want to help the yChat project please run gmake mail
- @echo so that the developers receive an email about the platform
- @echo being used.
- @echo WARNING! This software is EXPERIMENTAL!
-mail:
- @echo "VERSION:" > mail.tmp
- @${MAKE} version >> mail.tmp
- @echo >> mail.tmp
- @echo "UNAME:" >> mail.tmp
- @uname -a >> mail.tmp
- @echo >> mail.tmp
- @echo "DATE:" >> mail.tmp
- @date >> mail.tmp
- @echo >> mail.tmp
- @echo "COMPILER AND MAKE:" >> mail.tmp
- @cat g++.version make.version >> mail.tmp
- @cat mail.tmp | mail -s "Successfull build of yChat" successfullbuild@yhttpd.org
- @rm -f mail.tmp
-install: deinstall
-uninstall: deinstall
-deinstall:
- @echo Install/deinstall is not supported!
- @echo Start yChat with ./bin/ychat instead!
- @exit 1
-modules:
- @if test -d ./src/mods; then ${MAKE} -C ./src/mods; fi
-clean_modules:
- @if test -d ./src/mods; then ${MAKE} -C ./src/mods clean; fi
-base:
- @if test -f bin/ychat; then echo "Backing up old binary";if test -f bin/ychat.old; then rm -f bin/ychat.old; fi; mv bin/ychat bin/ychat.old; fi
- @perl ./scripts/buildnr.pl
- @perl ./scripts/setglobvals.pl
- @${MAKE} -C ./src
-clean_base:
- @${MAKE} -C ./src clean
-stats:
- @perl scripts/stats.pl
-run:
- ./bin/ychat
-base_start: base
- ./bin/ychat
-gpl:
- @more COPYING
-#//<<*
-yhttpdbase:
- @perl scripts/makeyhttpd.pl || echo "You need to have perl to do this!"
- @echo yhttpd code base has been generated in ../yhttpd
-#//*>>
-clean: clean_base clean_modules
-help:
- @echo "You may run ${MAKE} with the following parameters:"
- @grep "^ ${MAKE} " README
- @echo "For more questions read the README file or contact mail@ychat.org!"
-setup:
- @./configure
- @${MAKE}
-config:
- @sh -c "scripts/config.sh"
- @echo If you run ${MAKE} config from the command line then you may need
- @echo to rerun ./configure and recompile all now!
-
-mrproper: clean
- @if test -f src/glob.h.org; then mv -f src/glob.h.org src/glob.h;fi
- @if test -f g++.version; then rm -f g++.version; fi
- @if test -f make.version; then rm -f make.version; fi
- @if test -f src/Makefile; then rm -f src/Makefile; fi
- @if test -f bin/ychat; then find bin/ -name "*ychat*" | xargs rm -f; fi
- @if test -d src/mods; then find src/mods/*/ -name Makefile | xargs rm -f; fi
- @find . -name "*.add" | xargs rm -f
- @ls | grep core | xargs rm -f
-version:
- @./scripts/version.sh
-debug:
- @gdb bin/ychat ychat.core
-confdebug:
- ./configure -g3 -ggdb
-dist:
- @./scripts/makedist.sh
-ssltest:
- openssl genrsa -des3 -out privkey.pem 2048
- openssl req -new -x509 -key privkey.pem -out cert.pem -days 1095
- @mv -f privkey.pem cert.pem etc
-
-
-
+SRCS=base.cpp chat.cpp CHAT.cpp cmnd.cpp conf.cpp CONF.cpp cont.cpp html.cpp HTML.cpp main.cpp mutx.cpp MUTX.cpp name.cpp pool.cpp reqp.cpp room.cpp sock.cpp SOCK.cpp thrd.cpp TOOL.cpp user.cpp
+OBJS=$(SRCS:.cpp=.o)
+CC=c++
+LDFLAGS=-lstdc++ -g
+LDADD=-pthread -D_THREAD_SAFE
+all: ychat
+$(SRCS):
+ $(CC) $(CFLAGS) -c $*.cpp
+ychat: $(OBJS)
+ $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDADD)
+clean:
+ rm *.o
diff --git a/README.txt b/README.txt
index e68c165..af513e8 100644..100755
--- a/README.txt
+++ b/README.txt
@@ -1,5 +1,5 @@
-yChat++; Version Basic 0.1b (030320); Homepage: www.yChat.org
-Copyright (C) 2003 Paul C. Buetow ( Snooper@yChat.org, ICQ: 11655527 )
+yChat++; Homepage: www.yChat.org; Version 0.2
+Copyright (C) 2003 Paul C. Buetow, Volker Richter
-----------------------------------------------------------------
This program is free software; you can redistribute it and/or
@@ -58,6 +58,10 @@ base.cpp - Encapsulates vector fields of room's or user ( may be later
main.cpp - This includes the required manager headers for starting
the server and finally regulates the correct starting.
+pool.cpp - The implementation of the thread pool. all threads are stored
+ in a queue. Each thread will be reused if the assigned job is
+ finished.
+
reqp.cpp - This class implements the http request parser. If a client
starts a request to the server the reqp class will be
invoked.
@@ -163,7 +167,11 @@ chat room user
/ \
conf html
-History of lines of code ( including embedded comments ):
+Version Lines of code
+ 0.1 2402
+ 0.2 2377
-Version: Lines:
- Basic 0.1b 2402
+New in 0.2:
+ - POST request now work.
+ - Thread pool ( pool.cpp ).
+ - Bugfixes
diff --git a/SOCK.cpp b/SOCK.cpp
index c5b451e..c5b451e 100644..100755
--- a/SOCK.cpp
+++ b/SOCK.cpp
diff --git a/SOCK.h b/SOCK.h
index dacc05f..dacc05f 100644..100755
--- a/SOCK.h
+++ b/SOCK.h
diff --git a/TOOL.cpp b/TOOL.cpp
index 7709695..7709695 100644..100755
--- a/TOOL.cpp
+++ b/TOOL.cpp
diff --git a/TOOL.h b/TOOL.h
index de2c4a2..de2c4a2 100644..100755
--- a/TOOL.h
+++ b/TOOL.h
diff --git a/base.cpp b/base.cpp
index 553d090..9a67340 100644..100755
--- a/base.cpp
+++ b/base.cpp
@@ -4,39 +4,20 @@
#define BASE_CPP
#include "base.h"
-#include "MUTX.h"
base::base()
{
-#ifdef VERBOSE
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "base::base()" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
pthread_mutex_init (&mut_vec_elem, NULL );
}
base::~base( )
{
-#ifdef VERBOSE
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "base::~base( )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
pthread_mutex_destroy( &mut_vec_elem );
}
void
base::add_elem( name* p_name )
{
-#ifdef VERBOSE_
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "base::add_elem( name* )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
pthread_mutex_lock ( &mut_vec_elem );
vec_elem.push_back ( p_name );
pthread_mutex_unlock( &mut_vec_elem );
@@ -45,12 +26,6 @@ base::add_elem( name* p_name )
bool
base::del_elem( string &s_name )
{
-#ifdef VERBOSE_
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "base::del_elem( \"" << s_name << "\" )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
vector<name*>::iterator iter;
pthread_mutex_lock ( &mut_vec_elem );
@@ -73,12 +48,6 @@ base::del_elem( string &s_name )
name*
base::get_elem( string &s_name, bool &b_found )
{
-#ifdef VERBOSE_
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "base:get_elem( \"" << s_name << "\", bool )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
vector<name*>::iterator iter;
pthread_mutex_lock ( &mut_vec_elem );
@@ -104,12 +73,6 @@ base::get_elem( string &s_name, bool &b_found )
void
base::run_func( void (*func)(name*, void*), void* v_arg )
{
-#ifdef VERBOSE_
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "base:run_func( void (*func)(name*, void*), void* )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
vector<name*>::iterator iter;
pthread_mutex_lock ( &mut_vec_elem );
diff --git a/base.h b/base.h
index d1c37ba..d1c37ba 100644..100755
--- a/base.h
+++ b/base.h
diff --git a/chat.cpp b/chat.cpp
index 301739e..7b0ccd2 100644..100755
--- a/chat.cpp
+++ b/chat.cpp
@@ -11,17 +11,10 @@ using namespace std;
chat::chat( )
{
-#ifdef VERBOSE
- cout << "chat::chat()" << endl;
-#endif
-
}
chat::~chat( )
{
-#ifdef VERBOSE
- cout << "chat::~chat()" << endl;
-#endif
}
user*
@@ -34,12 +27,6 @@ chat::get_user( string &s_user )
user*
chat::get_user( string &s_user, bool &b_found )
{
-#ifdef VERBOSE_
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "chat::get_user( " << s_user << ", bool& )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
container param;
param.elem[0] = (void*) &s_user ;
@@ -56,11 +43,6 @@ chat::get_user( string &s_user, bool &b_found )
void
chat::get_user_( name *name_obj, void *v_arg )
{
-#ifdef VERBOSE_
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "chat::get_user_( name *name_obj, void *v_arg )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
container* param = (container*) v_arg;
room *room_obj = static_cast<room*>(name_obj);
param->elem[2] = (void*)room_obj->get_elem( *((string*)param->elem[0]), *((bool*)param->elem[1]) );
@@ -69,12 +51,6 @@ chat::get_user_( name *name_obj, void *v_arg )
void
chat::login( map_string &map_params )
{
-#ifdef VERBOSE_
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "chat::login( map_params )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
string s_user = map_params["nick"];
// prove if nick is empty
@@ -131,12 +107,6 @@ chat::login( map_string &map_params )
void
chat::post( user* u_user, map_string &map_params )
{
-#ifdef VERBOSE_
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "chat::post( user* u_user, map_string &map_params )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
string s_msg( "<font color=\"" );
s_msg.append( u_user->get_col1() )
.append( "\">" )
diff --git a/chat.h b/chat.h
index 164c0c4..164c0c4 100644..100755
--- a/chat.h
+++ b/chat.h
diff --git a/cmnd.cpp b/cmnd.cpp
index d6efc23..9ab008a 100644..100755
--- a/cmnd.cpp
+++ b/cmnd.cpp
@@ -10,20 +10,10 @@ using namespace std;
cmnd::cmnd( )
{
-#ifdef VERBOSE
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "cmnd::cmnd( )" << cout;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
}
cmnd::~cmnd()
{
-#ifdef VERBOSE
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "cmnd::~cmnd( )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
}
#endif
diff --git a/cmnd.h b/cmnd.h
index 2eb1db2..2eb1db2 100644..100755
--- a/cmnd.h
+++ b/cmnd.h
diff --git a/conf.cpp b/conf.cpp
index 2c7705e..5214edb 100644..100755
--- a/conf.cpp
+++ b/conf.cpp
@@ -10,26 +10,16 @@ using namespace std;
conf::conf( string s_conf = CONFILE ) : name( s_conf )
{
-#ifdef VERBOSE
- cout << "conf::conf()" << endl;
-#endif
-
parse( ); // parse the config file.
}
conf::~conf()
{
-#ifdef VERBOSE
- cout << "conf::~conf()" << endl;
-#endif
}
void
conf::parse()
{
-#ifdef VERBOSE_
- cout << "conf::parse()" << endl;
-#endif
#ifdef _VERBOSE
cout << CFILEOK << get_name() << endl;
#endif
diff --git a/conf.h b/conf.h
index a3b5022..a3b5022 100644..100755
--- a/conf.h
+++ b/conf.h
diff --git a/conf.txt b/conf.txt
index c8d4ba7..c31c554 100644..100755
--- a/conf.txt
+++ b/conf.txt
@@ -17,8 +17,9 @@
# server specific configurations ( not allowed to be removed ):
HTMLTEMP="html/"; # directory of the html-template files.
-THRDPOOL="100"; # thread pool size. every time all threads are used so many new
+THRDPOOL="10"; # thread pool size. every time all threads are used so many new
# threads will be added to the pool.
+THRDQUEU="100"; # length of the thread pool queue.
SRVRPORT="2000"; # local port on which the server listens.
STRDROOM="Lounge"; # the name of the standard room.
diff --git a/cont.cpp b/cont.cpp
index e650d34..91cbbca 100644..100755
--- a/cont.cpp
+++ b/cont.cpp
@@ -11,11 +11,6 @@ using namespace std;
string
cont::get_val( string s_key )
{
-#ifdef VERBOSE_
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "cont::get_val( \"" << s_key << "\" )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
if ( map_vals.find( s_key ) != map_vals.end() )
return map_vals[ s_key ];
return string();
@@ -23,12 +18,6 @@ cont::get_val( string s_key )
cont::~cont()
{
-#ifdef VERBOSE_
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "cont::cont()" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
map_vals.~map_string();
}
diff --git a/cont.h b/cont.h
index 06a09e2..06a09e2 100644..100755
--- a/cont.h
+++ b/cont.h
diff --git a/data.h b/data.h
index 55dbc69..55dbc69 100644..100755
--- a/data.h
+++ b/data.h
diff --git a/gfx/CVS/Root b/gfx/CVS/Root
index 4ab853d..6de547b 100644
--- a/gfx/CVS/Root
+++ b/gfx/CVS/Root
@@ -1 +1 @@
-:pserver:volker@cvs.exa-ds.com:/home/cvsroot
+:pserver:paul@internal.ath.cx:/home/cvsroot
diff --git a/gfx/y_ani_black.gif b/gfx/y_ani_black.gif
index 06274c2..06274c2 100644..100755
--- a/gfx/y_ani_black.gif
+++ b/gfx/y_ani_black.gif
Binary files differ
diff --git a/gfx/y_ani_white.gif b/gfx/y_ani_white.gif
index 168c937..168c937 100644..100755
--- a/gfx/y_ani_white.gif
+++ b/gfx/y_ani_white.gif
Binary files differ
diff --git a/glob.h b/glob.h
index f48f3c0..37741f8 100644..100755
--- a/glob.h
+++ b/glob.h
@@ -21,20 +21,10 @@
// max length of a line read from a socket or a file ( config-file, html-template ).
#define READBUF 1024
-// if defined for every http request a new thread will be created. otherwise only for the
-// chat streams extra threads will be created. THRDMOD2 DOES NOT WORK RIGHT NOW!! SO
-// LET THIS DEFINE UNTOUCHED! BUGFIX WILL FOLLOW!
-#define THRDMOD
-
// definition for verbosity level 0 ( normal outputs ). see vmsg.h for custumizing all
// the messages. this messages will only printed out by the master thread.
#define _VERBOSE
-// definition for verbosity level 1 ( constructors and destructors which are not inline ).
-//#define VERBOSE
-
-// definition for verbosity level 2 ( all methods which are not inline except VERBOSE 1 ).
-//#define VERBOSE_
//////////////////////////////////////////////////////////////////////////////////////////
// DO NOT CHANGE ANYTHING BEHIND THIS LINE!
diff --git a/html.cpp b/html.cpp
index 2e6b977..ad0de08 100644..100755
--- a/html.cpp
+++ b/html.cpp
@@ -12,25 +12,12 @@ using namespace std;
html::html( )
{
-#ifdef VERBOSE
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "html::html()" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
set_name( CONF::get().get_val( "HTMLTEMP" ) );
-
pthread_mutex_init( &mut_map_vals, NULL );
}
html::~html( )
{
-#ifdef VERBOSE
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "html::~html()" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
pthread_mutex_destroy( &mut_map_vals );
}
@@ -45,13 +32,6 @@ html::clear_cache( )
string
html::parse( map_string &map_params )
{
-
-#ifdef VERBOSE_
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "html::parse( map_string& )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
string s_file = map_params["request"];
// check if s_file is in the container.
@@ -132,12 +112,6 @@ html::parse( map_string &map_params )
void
html::online_list( user *p_user, map_string &map_params )
{
-#ifdef VERBOSE_
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "html::online_list( user*, map_string& )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
// prepare user_list.
string s_list ( "" );
string s_seperator( "<br>" );
diff --git a/html.h b/html.h
index 97b5b67..9acf5a9 100644..100755
--- a/html.h
+++ b/html.h
@@ -9,6 +9,7 @@
#include "user.h"
#include "name.h"
+
using namespace std;
class html : public cont, name
diff --git a/html/CVS/Entries b/html/CVS/Entries
index 12eb550..6738646 100644
--- a/html/CVS/Entries
+++ b/html/CVS/Entries
@@ -1,11 +1,9 @@
/blank.html/1.1.1.1/Fri Mar 21 15:54:56 2003//
/frameset.html/1.1.1.1/Fri Mar 21 15:54:56 2003//
-/index.html/1.4/Sun Mar 30 00:34:08 2003//
-/input.html/1.2/Sun Mar 30 00:34:08 2003//
+/index.html/1.2/Sun Mar 23 19:03:13 2003//
+/input.html/1.1.1.1/Fri Mar 21 15:54:56 2003//
/notfound.html/1.1.1.1/Fri Mar 21 15:54:56 2003//
-/online.html/1.2/Sun Mar 30 00:34:08 2003//
-/stream.html/1.2/Sun Mar 30 00:34:08 2003//
-/style.css/1.1/Sun Mar 30 11:12:49 2003//
+/online.html/1.1.1.1/Fri Mar 21 15:54:56 2003//
+/stream.html/1.1.1.1/Fri Mar 21 15:54:56 2003//
/y_ani.gif/1.1.1.1/Fri Mar 21 15:54:56 2003//
-/y_black.gif/1.1/Sun Mar 30 11:12:49 2003/-kb/
D
diff --git a/html/CVS/Root b/html/CVS/Root
index 4ab853d..6de547b 100644
--- a/html/CVS/Root
+++ b/html/CVS/Root
@@ -1 +1 @@
-:pserver:volker@cvs.exa-ds.com:/home/cvsroot
+:pserver:paul@internal.ath.cx:/home/cvsroot
diff --git a/html/frameset.html b/html/frameset.html
index 672f8fa..fe6b973 100755
--- a/html/frameset.html
+++ b/html/frameset.html
@@ -1,21 +1,19 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>
- %%ychat.version%%
+ %%PGETITLE%%
</title>
</head>
- <frameset boders="0" rows="*,70">
+ <frameset rows="*,60">
<noframes>
Your browser does not support frames,
</noframes>
<frameset cols="*,150">
- <frame src="stream.html?event=stream&tmpid=%%tmpid%%" name="stream">
- <frame src="online.html?event=online&tmpid=%%tmpid%%" name="online">
+ <frame src="stream.html?event=stream&nick=%%nick%%&tmpid=%%tmpid%%" name="stream">
+ <frame src="online.html?event=online&nick=%%nick%%&tmpid=%%tmpid%%" name="online">
</frameset>
<frameset rows="*,0">
- <frame src="input.html?event=input&tmpid=%%tmpid%%" name="input">
+ <frame src="input.html?event=input&nick=%%nick%%&tmpid=%%tmpid%%" name="input">
<frame src="blank.html" name="blank">
</frameset>
</frameset>
diff --git a/html/index.html b/html/index.html
index 983e7ef..172c851 100755
--- a/html/index.html
+++ b/html/index.html
@@ -1,54 +1,31 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>
- %%ychat.version%%
+ %%PGETITLE%%
</title>
-<link rel=stylesheet href="style.css" type=text/css>
</head>
<body>
-<table align=center width=500>
-<tr>
-<td>
-<center>
-%%ychat.version%%<br><br>%%INFO%%
-</center>
-</td>
-</tr>
-<tr>
-<td colspan=2>&nbsp;</td>
-</tr>
-<tr>
-<td align=center colspan=2>
+Welcome to
+<pre>
+ ___ _ _
+ _ _ / __\ |__ __ _| |_
+| | | |/ / | '_ \ / _` | __|
+| |_| / /___| | | | (_| | |_
+ \__, \____/|_| |_|\__,_|\__|
+ |___/
+</pre>
+
+<br>
+%%PGETITLE%%
+<br>
+<br>
+%%INFO%%
+Enter your nick:
<form action="frameset.html" method="POST">
<input type="hidden" name="event" value="login">
-Enter your nick:<br>
- <input class="text" type="text" name="nick" value="%%nick%%" maxlength="%%chat.maxlength.username%%" accesskey="n">
-<br>
-<br>
-Enter your password:<br>
- <input class="text" type="password" name="password" value="%%pass%%" maxlength="%%chat.maxlength.password%%" accesskey="p">
-<br>
-<br>
-Enter your room:<br>
- <input class="text" type="text" name="room" value="%%chat.defaultroom%%" maxlength="%%chat.maxlength.roomname%%" accesskey="r">
-<br>
-<br>
- <input type="hidden" name="end" value="end">
- <input type="submit" value="login" accesskey="s">
+ <input type="hidden" name="room" value="%%STRDROOM%%">
+ <input type="text" name="nick">
+ <input type="submit" value="login">
</form>
-<br>
-<a class="fancy" href="register.html">Register</a> a new nick
-<br>
-<br>
-If you don't want to register you may login
-<br>
-without a password using an unregistered nick.
-</td>
-</tr>
-</table>
-<br><br>
-<center><span class="signature">yChat is OpenSource - get it at <a class="fancy" target="_blank" href="http://www.yChat.org">http://www.yChat.org</a></span></center>
</body>
</html>
diff --git a/html/input.html b/html/input.html
index 31ed9fe..e6fb016 100755
--- a/html/input.html
+++ b/html/input.html
@@ -1,60 +1,32 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <head>
<title>
- %%HTML_TITLE_TAG_CONTENT%%
+ %%PGETITLE%%
</title>
- <link rel=stylesheet href="style.css" type=text/css>
<script language="JavaScript">
<!--
function delout()
{
- document.input.message.value = document.input.message.value.replace(/&/g, '\\AND');
- document.input.submit();
- document.input.message.value = "";
document.input.message.focus();
+ document.input.message.select();
+ document.input.submit();
return false;
}
function selectinput()
{
document.input.message.select();
}
- function popup(site,width,height)
- {
- var left = (screen.availWidth-width)/2;
- var top = (screen.availHeight-height)/2;
- var win = window.open(site,"_blank","width="+width+",height="+height+",left="+left+",top="+top+",scrollbars=yes");
- }
- function chgscroll(f)
- {
- if(f.checked)
- parent.stream.autoscroll();
- else
- parent.stream.stopscroll();
- }
//-->
</script>
</head>
<body>
- <form method="GET" name="input" action="input.html" target="blank" onsubmit="return delout();">
- <div style="position: absolute; top: 5px;">
- <input class="text" type="text" name="message" size="60" maxlength="%%chat.maxlength.message%%">
- <input type="submit" value="Send" accesskey='s'>
- <input type="button" value="Select" accesskey='e' onclick="javascript:selectinput();">
- </div>
- <div style="position: absolute; top: 29px;">
- <a href='#' class="fancy" onclick="javascript:popup('colors.html?event=colors&tmpid=%%tmpid%%', 600, 480)">Colors</a>
- <a href='#' class="fancy" onclick="javascript:popup('options.html?event=options&tmpid=%%tmpid%%', 600, 480)">Options</a>
- <a href='#' class="fancy" onclick="javascript:popup('help.html?event=help&tmpid=%%tmpid%%', 600, 480)">Help</a>
- <a href='#' class="fancy" onclick="javascript:popup('loggedin.html?event=loggedin&tmpid=%%tmpid%%', 600, 480)">Users</a>
- <a href='#' class="fancy" onclick="javascript:popup('admin.html?event=admin&tmpid=%%tmpid%%', 600, 480)">Admin</a>
- <a href='input.html?event=input&tmpid=%%tmpid%%&message=%2Fq' class="fancy" target='blank'>Logout</a>
- Scrolling:
- <input type="checkbox" name="scroll" checked onClick="chgscroll(this);">
- </div>
- <input type="hidden" name="event" value="input">
+ <form name="input" action="input.html" target="blank" onsubmit="return delout();">
+ <input type="hidden" name="event" value="post">
+ <input type="hidden" name="nick" value="%%nick%%">
<input type="hidden" name="tmpid" value="%%tmpid%%">
+ <input type="text" name="message" size="50">
+ <input type="submit" value="send">
+ <input type="button" value="select" onclick="javascript:selectinput();">
</form>
</body>
</html>
diff --git a/html/notfound.html b/html/notfound.html
index a14d44b..574e341 100755
--- a/html/notfound.html
+++ b/html/notfound.html
@@ -1,9 +1,7 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>
- %%HTML_TITLE_TAG_CONTENT%%
+ %%PGETITLE%%
</title>
</head>
<body>
diff --git a/html/online.html b/html/online.html
index 3eda553..7f29b0e 100755
--- a/html/online.html
+++ b/html/online.html
@@ -1,20 +1,6 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <link rel=stylesheet href="style.css" type=text/css>
- </head>
+ <meta http-equiv="refresh" content="20">
<body>
- <b>%%room%%</b>
- <br>
- <br>
- <table>
- <tr>
- <td>
- %%topic%%
- </td>
- </tr>
- %%userlist%%
- </table>
+ %%MESSAGE%%
</body>
</html>
diff --git a/html/stream.html b/html/stream.html
index 4814979..66f8bbd 100755
--- a/html/stream.html
+++ b/html/stream.html
@@ -1,38 +1,29 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <head>
<title>
- %%HTML_TITLE_TAG_CONTENT%%
+ %%PGETITLE%%
</title>
-<link rel=stylesheet href="style.css" type=text/css>
<script language="JavaScript">
- var scrolling;
- var ison;
- function autoscroll()
+ function autoScroll()
{
- if(!ison){
- scrolling = window.setInterval("window.scroll(1,1606682)",70);
- ison = true;
- }
+ window.scroll(1, 50000 );
+ timer = setTimeout('autoScroll()',200);
}
- function stopscroll()
+
+ autoScroll();
+
+ function stopScroll()
{
- if(ison)
- {
- window.clearInterval(scrolling);
- ison = false;
- }
+ clearTimeout(timer);
+ }
+
+ function startScroll()
+ {
+ timer = setTimeout('autoScroll()', 200);
}
</script>
</head>
-<body class="stream">
-<h1>Engine: %%ychat.version%%</h1>
-<script language="JavaScript">
- autoscroll();
-</script>
-
- Welcome to the chat, %%nick%%!
+<body>
+ Welcome to yChat %%nick%%!
<br>
<br>
-
diff --git a/html/y_ani.gif b/html/y_ani.gif
index e730988..e730988 100644..100755
--- a/html/y_ani.gif
+++ b/html/y_ani.gif
Binary files differ
diff --git a/incl.h b/incl.h
index 423f5e2..f8e483f 100644..100755
--- a/incl.h
+++ b/incl.h
@@ -12,6 +12,5 @@
// include all the custom global variables.
#include "glob.h"
-
// include all the custom messages.
#include "msgs.h"
diff --git a/main.cpp b/main.cpp
index 502e24d..2cbc713 100644..100755
--- a/main.cpp
+++ b/main.cpp
@@ -19,7 +19,6 @@
*
*/
-
// needed for ignoring SIGPIPE.
#include <signal.h>
@@ -54,9 +53,8 @@ cout << " ___ _ _ " << endl
<< " \\__, \\____/|_| |_|\\__,_|\\__|" << endl
<< " |___/ " << endl << endl
- << DESCRIP
- << VERSION << endl
- << VERSION << endl
+ << DESCRIP << endl
+ << VERSION << ", "
<< CONTACT << endl
<< SEPERAT << endl
<< STARTMS << endl ;
diff --git a/msgs.h b/msgs.h
index 65a71e1..f57301c 100644..100755
--- a/msgs.h
+++ b/msgs.h
@@ -19,8 +19,8 @@
#define CFILEOK "Parsing config file "
#define CFILENO "Failed opening config file "
#define CONNECT "Receiving connection "
-#define CONTACT "EMail: Snooper@yChat.org, ICQ: 11655527 "
-#define DESCRIP "yChat++ Basic Copyright (C) 2003 Paul C. Buetow "
+#define CONTACT "Contact: www.yChat.org, Mail@yChat.org "
+#define DESCRIP "yChat++ Copyright (C) 2003 Paul C. Buetow, Volker Richer "
#define DOWNMSG "Shutting down "
#define LOGINPR "Login procedure succeeded for nick "
#define NEWROOM "Adding room "
@@ -31,9 +31,8 @@
#define SOCKRDY "Server socket is ready. See port above "
#define STARTMS "Starting up "
#define TECACHE "Caching template "
-#define THREAD1 "Spawning thread ( Mode 1 ) "
-#define THREAD2 "Spawning thread ( Mode 2 ) "
-#define THRPOOL "Refilling thread pool "
-#define VERSION "Version Basic 0.1b (030320) "
+#define THREADS "Starting thread job "
+#define THREADE "Exiting thread job "
+#define VERSION "Version: 0.2"
#endif
diff --git a/mutx.cpp b/mutx.cpp
index ff67ed2..bbd5ced 100644..100755
--- a/mutx.cpp
+++ b/mutx.cpp
@@ -9,19 +9,11 @@ using namespace std;
mutx::mutx()
{
-#ifdef VERBOSE
- cout << "mutx::mutx()" << endl;
-#endif
-
pthread_mutex_init( &mut_stdout, NULL );
}
mutx::~mutx()
{
-#ifdef VERBOSE
- cout << "mutx::~mutx()" << endl;
-#endif
-
pthread_mutex_destroy( &mut_stdout );
}
diff --git a/mutx.h b/mutx.h
index 4f6c950..4f6c950 100644..100755
--- a/mutx.h
+++ b/mutx.h
diff --git a/name.cpp b/name.cpp
index 56e73a2..3ef1280 100644..100755
--- a/name.cpp
+++ b/name.cpp
@@ -4,51 +4,27 @@
#define NAME_CXX
#include "name.h"
-#include "MUTX.h"
using namespace std;
name::name( string s_name )
{
-#ifdef VERBOSE_
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "name::name( \"" << s_name << "\" )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
set_name( s_name );
}
name::~name()
{
-#ifdef VERBOSE_
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "name::~name[ " << s_name << " ]" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
}
string
name::get_name() const
{
-#ifdef VERBOSE_
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "name::get_name()" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
return s_name;
}
void
name::set_name( string s_name )
{
-#ifdef VERBOSE_
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "name::set_name( \"" << s_name << "\" )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
this->s_name = s_name;
}
#endif
diff --git a/name.h b/name.h
index 28a2f91..28a2f91 100644..100755
--- a/name.h
+++ b/name.h
diff --git a/pool.cpp b/pool.cpp
index 470ea24..503d0f7 100755
--- a/pool.cpp
+++ b/pool.cpp
@@ -5,17 +5,17 @@
#include "pool.h"
-#include "s_conf.h"
-#include "s_mutx.h"
-#include "s_tool.h"
+#include "CONF.h"
+#include "MUTX.h"
+#include "TOOL.h"
#include "thrd.h"
using namespace std;
pool::pool()
{
- i_thrd_pool_size = s_tool::string2int( s_conf::get().get_val( "THRDPOOL" ) );
- i_thrd_pool_queue = s_tool::string2int( s_conf::get().get_val( "THRDQUEU" ) );
+ i_thrd_pool_size = TOOL::string2int( CONF::get().get_val( "THRDPOOL" ) );
+ i_thrd_pool_queue = TOOL::string2int( CONF::get().get_val( "THRDQUEU" ) );
tpool_init( &thread_pool, i_thrd_pool_size, i_thrd_pool_queue, 0 );
}
@@ -34,9 +34,9 @@ pool::tpool_init( tpool_t *tpoolp, int num_worker_threads, int max_queue_size, i
// allocate a pool data structure
if (( tpool = (tpool_t) malloc( sizeof( struct tpool ) ) ) == NULL )
{
- pthread_mutex_lock ( &s_mutx::get().mut_stdout );
+ pthread_mutex_lock ( &MUTX::get().mut_stdout );
cerr << "malloc" << endl;
- pthread_mutex_unlock( &s_mutx::get().mut_stdout );
+ pthread_mutex_unlock( &MUTX::get().mut_stdout );
exit(-1);
}
@@ -47,9 +47,9 @@ pool::tpool_init( tpool_t *tpoolp, int num_worker_threads, int max_queue_size, i
if ( ( tpool->threads = (pthread_t*) malloc( sizeof( pthread_t ) *num_worker_threads ) ) == NULL )
{
- pthread_mutex_lock ( &s_mutx::get().mut_stdout );
+ pthread_mutex_lock ( &MUTX::get().mut_stdout );
cerr << "malloc" << endl;
- pthread_mutex_unlock( &s_mutx::get().mut_stdout );
+ pthread_mutex_unlock( &MUTX::get().mut_stdout );
exit(-1);
}
@@ -61,33 +61,33 @@ pool::tpool_init( tpool_t *tpoolp, int num_worker_threads, int max_queue_size, i
if ( ( rtn = pthread_mutex_init( &(tpool->queue_lock), NULL ) ) != 0 )
{
- pthread_mutex_lock ( &s_mutx::get().mut_stdout );
+ pthread_mutex_lock ( &MUTX::get().mut_stdout );
cerr << "pthread_mutex_init " << strerror( rtn ) << endl;
- pthread_mutex_unlock( &s_mutx::get().mut_stdout );
+ pthread_mutex_unlock( &MUTX::get().mut_stdout );
exit(-1);
}
else if ( ( rtn = pthread_cond_init( &(tpool->queue_not_empty), NULL ) ) != 0 )
{
- pthread_mutex_lock ( &s_mutx::get().mut_stdout );
+ pthread_mutex_lock ( &MUTX::get().mut_stdout );
cerr << "pthread_cond_init " << strerror( rtn ) << endl;
- pthread_mutex_unlock( &s_mutx::get().mut_stdout );
+ pthread_mutex_unlock( &MUTX::get().mut_stdout );
exit(-1);
}
else if ( ( rtn = pthread_cond_init( &(tpool->queue_not_full), NULL ) ) != 0 )
{
- pthread_mutex_lock ( &s_mutx::get().mut_stdout );
+ pthread_mutex_lock ( &MUTX::get().mut_stdout );
cerr << "pthread_cond_init " << strerror( rtn ) << endl;
- pthread_mutex_unlock( &s_mutx::get().mut_stdout );
+ pthread_mutex_unlock( &MUTX::get().mut_stdout );
exit(-1);
}
else if ( ( rtn = pthread_cond_init( &(tpool->queue_empty), NULL ) ) != 0 )
{
- pthread_mutex_lock ( &s_mutx::get().mut_stdout );
+ pthread_mutex_lock ( &MUTX::get().mut_stdout );
cerr << "pthread_cond_init " << strerror( rtn ) << endl;
- pthread_mutex_unlock( &s_mutx::get().mut_stdout );
+ pthread_mutex_unlock( &MUTX::get().mut_stdout );
exit(-1);
}
// create threads
@@ -140,10 +140,10 @@ pool::tpool_thread( void* arg )
void pool::run_func( void *v_pointer )
{
-#ifdef VERBOSE
- pthread_mutex_lock ( &s_mutx::get().mut_stdout );
+#ifdef _VERBOSE
+ pthread_mutex_lock ( &MUTX::get().mut_stdout );
cout << THREADS << endl;
- pthread_mutex_unlock( &s_mutx::get().mut_stdout );
+ pthread_mutex_unlock( &MUTX::get().mut_stdout );
#endif
// recasting the client thread object.
@@ -157,10 +157,10 @@ void pool::run_func( void *v_pointer )
free(v_pointer);
-#ifdef VERBOSE
- pthread_mutex_lock ( &s_mutx::get().mut_stdout );
+#ifdef _VERBOSE
+ pthread_mutex_lock ( &MUTX::get().mut_stdout );
cout << THREADE << endl;
- pthread_mutex_unlock( &s_mutx::get().mut_stdout );
+ pthread_mutex_unlock( &MUTX::get().mut_stdout );
#endif
}
diff --git a/reqp.cpp b/reqp.cpp
index 52de971..6cea6a9 100644..100755
--- a/reqp.cpp
+++ b/reqp.cpp
@@ -7,6 +7,7 @@
#include "CHAT.h"
#include "HTML.h"
#include "MUTX.h"
+#include "sock.h"
using namespace std;
@@ -20,27 +21,29 @@ string reqp::HTTP_COTYPE = "Content-Type: text/html\n\n";
reqp::reqp( )
{
-#ifdef VERBOSE
- cout << "reqp::reqp()" << endl;
-#endif
}
string
-reqp::get_url( string s_req, map_string &map_params )
+reqp::get_url( thrd* p_thrd, string s_req, map_string &map_params )
{
-#ifdef VERBOSE_
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "reqp::get_url( s_req )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
+ auto unsigned int pos;
+ string s_ret ( "" );
+ string s_vars( "" );
+ auto int i_request;
+
+ i_request= ( s_req.find("GET",0) != string::npos ) ? RQ_GET : RQ_POST;
- auto unsigned int pos = s_req.find( "HTTP", 0 );
- string s_ret = s_req.substr( 5, pos-6 );
+ pos = s_req.find( "HTTP", 0 );
+
+ if( i_request == RQ_GET )
+ s_ret.append( s_req.substr( 5, pos-6 ) );
+ else
+ s_ret.append( s_req.substr( 6, pos-7 ) );
// remove ".." from the request.
do
{
- pos = s_ret.find( "..", 0 );
+ pos = s_ret.find( "../", 0 );
if ( pos == string::npos )
break;
@@ -50,32 +53,52 @@ reqp::get_url( string s_req, map_string &map_params )
while( true );
// do not add the string behind "?" tp s_ret and add all params behind "?" to map_params.
- pos = s_ret.find( "?", 0 );
+ if( i_request == RQ_GET )
+ pos = s_ret.find( "?", 0 );
+ else
+ pos = s_req.find("\r\n\r\n", 0);
+
+ auto string s_params( "" );
if ( pos != string::npos )
{
- auto string s_params = s_ret.substr( pos+1, s_ret.length() -pos-1 );
+ if( i_request == RQ_GET )
+ s_params.append( s_ret.substr( pos+1, s_ret.length() -pos-1 ) );
+
+ else
+ s_params = s_req.substr( pos+4, s_req.length() -pos-1 );
+
s_ret = s_ret.substr( 0, pos );
+ }
- auto unsigned int pos2;
- do
- {
- pos = s_params.find( "=", 0 );
- if ( pos == string::npos )
- break;
+ if ( i_request == RQ_POST && s_params.empty() )
+ {
+ char c_req[READBUF];
+ read ( p_thrd->get_sock() , c_req, READBUF );
+ s_params = string( strstr( c_req, "event" ) );
+ }
- pos2 = s_params.find( "&", 0 );
- if ( pos2 == string::npos )
- {
- map_params[ s_params.substr( 0, pos ) ] = s_params.substr( pos+1, s_params.length()-pos-1 );
- break;
- }
+ auto unsigned int pos2;
+ do
+ {
+ pos = s_params.find( "=", 0 );
+ if ( pos == string::npos )
+ break;
- map_params[ s_params.substr( 0, pos ) ] = s_params.substr( pos+1, pos2-pos-1 );
- s_params = s_params.substr( pos2+1, s_params.length()-pos2-1 );
+ pos2 = s_params.find( "&", 0 );
+ if ( pos2 == string::npos )
+ {
+ auto string sValue( s_params.substr(pos+1, s_params.length()-pos-1) );
+ auto string tmpstr( url_decode(sValue) );
+ map_params[ s_params.substr( 0, pos ) ] = tmpstr;
+ break;
}
- while( true );
+ auto string s_temp= s_params.substr( pos+1, pos2-pos-1 );
+ map_params[ s_params.substr( 0, pos ) ] = url_decode(s_temp);
+
+ s_params = s_params.substr( pos2+1, s_params.length()-pos2-1 );
}
+ while( true );
#ifdef _VERBOSE
pthread_mutex_lock ( &MUTX::get().mut_stdout );
@@ -88,15 +111,57 @@ reqp::get_url( string s_req, map_string &map_params )
return s_ret;
}
+int
+reqp::htoi(string *s)
+{
+ int value;
+ int c;
+
+ c=s->c_str()[0];
+ if(isupper(c))
+ c=tolower(c);
+
+ value=(c>='0' && c<='9'?c-'0':c-'a'+10)*16;
+
+ c=s->c_str()[1];
+ if(isupper(c))
+ c=tolower(c);
+
+ value+=c>='0' && c<='9'?c-'0':c-'a'+10;
+ return value;
+}
+
string
-reqp::get_from_header( string s_req, string s_hdr )
+reqp::url_decode( string s_str )
{
-#ifdef VERBOSE_
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "reqp::get_from_header( s_req, \"" << s_hdr << "\" )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
+ auto string sDest="";
+ int len = s_str.size();
+
+ for(int i=0;i<len;i++)
+ {
+ char ch = s_str.at(i);
+ if(ch=='+')
+ {
+ sDest+=" ";
+ }
+ else if(ch=='%')
+ {
+ auto string sTmp=s_str.substr(i+1,2);
+ ch=(char)htoi(&sTmp);
+ sDest+=ch;
+ i+=2;
+
+ }
+ else
+
+ sDest+=ch;
+ }
+ return sDest;
+}
+string
+reqp::get_from_header( string s_req, string s_hdr )
+{
auto unsigned int pos[2];
pos[0] = s_req.find( s_hdr, 0 );
pos[1] = s_req.find( "\n", pos[0] );
@@ -106,14 +171,8 @@ reqp::get_from_header( string s_req, string s_hdr )
}
string
-reqp::parse( string s_req, map_string &map_params )
+reqp::parse( thrd* p_thrd, string s_req, map_string &map_params )
{
-#ifdef VERBOSE_
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "reqp::parse( s_req )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
// create the http header.
string s_rep( HTTP_CODEOK ); s_rep.append( HTTP_SERVER );
s_rep.append( HTTP_CONTAC ); s_rep.append( HTTP_CACHEC );
@@ -121,7 +180,7 @@ reqp::parse( string s_req, map_string &map_params )
// store all request informations in map_params. store the url in
// map_params["request"].
- get_url( s_req, map_params );
+ get_url( p_thrd, s_req, map_params );
// check the event variable.
string s_event( map_params["event"] );
diff --git a/reqp.h b/reqp.h
index 601c680..4e68a25 100644..100755
--- a/reqp.h
+++ b/reqp.h
@@ -3,8 +3,12 @@
#ifndef REQP_H
#define REQP_H
+#define RQ_GET 1
+#define RQ_POST 2
+
#include <map>
#include "incl.h"
+#include "thrd.h"
using namespace std;
@@ -24,15 +28,18 @@ private:
// returns the request url from thr client's http request header
// until the first "?" and stores all request parameter values
// ( behind "?" ) into map_params.
- virtual string get_url( string s_req, map_string &map_params );
+ virtual string get_url( thrd* p_thrd, string s_req, map_string &map_params );
// returns a specific value of the client's http request header.
// ( s.t. like the User-Agent, Referer etc... ).
virtual string get_from_header( string s_req, string s_hdr );
+ virtual int htoi( string *s );
+
public:
// public methods.
explicit reqp( ); // simple constructor.
- virtual string parse( string s_req, map_string &map_params );
+ virtual string parse( thrd* p_thrd, string s_req, map_string &map_params );
+ virtual string url_decode (string );
};
#endif
diff --git a/room.cpp b/room.cpp
index 2e4971b..0e905e6 100644..100755
--- a/room.cpp
+++ b/room.cpp
@@ -4,26 +4,15 @@
#define ROOM_CXX
#include "room.h"
-#include "MUTX.h"
using namespace std;
room::room( string s_name ) : name( s_name )
{
-#ifdef VERBOSE
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "room::room( \"" << s_name << "\" )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
}
room::~room()
{
-#ifdef VERBOSE
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "room::~room[ " << get_name() << " ]" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
}
#endif
diff --git a/room.h b/room.h
index 077fd28..077fd28 100644..100755
--- a/room.h
+++ b/room.h
diff --git a/sock.cpp b/sock.cpp
index 009396f..c996ff5 100644..100755
--- a/sock.cpp
+++ b/sock.cpp
@@ -17,40 +17,22 @@
using namespace std;
-
-// the posix thread function. this one will called every time a new request socket
-// was created succsessfull. in this function a new POSIX thread life begins.
-// be carefull because of synchronization issues!!!!
-void *sock::posix_thread_func( void *v_pointer )
+sock::sock()
{
-#ifdef VERBOSE_
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "*posix_thread_func( void *v_pointer )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
- // recasting the client thread object.
- thrd *t = (thrd*) v_pointer;
-
- // start parsing the client request and sending response's back.
- t-> run ();
-
- t->~thrd();
+ this->b_run = true;
+ this->i_req = 0;
+ this->req_parser = new reqp();
+ this->thrd_pool = new pool();
}
-void *sock::posix_thread_func_( void *v_pointer )
+void
+sock::chat_stream( int i_sock, map_string &map_params )
{
-#ifdef VERBOSE_
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "*posix_thread_func_( void *v_pointer )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
- user *p_user = (user*) v_pointer;
+ user* p_user = CHAT::get().get_user( map_params["nick"] );
+ p_user->set_sock( i_sock );
string s_msg( "" );
- int i_sock = p_user->get_sock();
pthread_mutex_lock ( &(p_user->mut_message) );
while( p_user->get_online() )
@@ -60,6 +42,7 @@ void *sock::posix_thread_func_( void *v_pointer )
if ( 0 > send( i_sock, s_msg.c_str(), s_msg.size(), 0 ) )
p_user->set_online( false );
}
+
pthread_mutex_unlock( &(p_user->mut_message) );
// remove the user from its room.
@@ -72,63 +55,9 @@ void *sock::posix_thread_func_( void *v_pointer )
p_user->~user();
}
-sock::sock()
-{
-#ifdef VERBOSE
- cout << "sock::sock()" << endl;
-#endif
-
- this->b_run = true;
- this->i_req = 0;
- this->req_parser = new reqp();
-}
-
-void
-#ifdef THRDMOD
-sock::chat_stream( int i_sock, map_string &map_params )
-#else
-sock::chat_stream( int i_sock, map_string &map_params, queue<pthread_t> &thrd_pool )
-#endif
-{
-#ifdef VERBOSE_
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "sock::chat_stream( " << i_sock << ", map_string& )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
- user* p_user = CHAT::get().get_user( map_params["nick"] );
- p_user->set_sock( i_sock );
-
-#ifdef THRDMOD
- posix_thread_func_( (void*) p_user );
-#else
-
-#ifdef _VERBOSE
- cout << THREAD2 << endl;
-#endif
- posix_thread_func_( (void*) p_user );
-
- auto int i_fail = pthread_create( &thrd_pool.front(), NULL, posix_thread_func_, (void*) p_user );
-
- // remove this thread from thread pool because its now in use.
- thrd_pool.pop();
-
- // check if the thread started correctly.
- if ( i_fail )
- {
- cerr << "Thrd: error with return code " << i_fail << endl;
- }
-
-#endif
-}
-
int
sock::make_socket( uint16_t i_port )
{
-#ifdef VERBOSE_
- cout << "sock::make_socket( " << i_port << " )" << endl;
-#endif
-
int sock;
struct sockaddr_in name;
@@ -149,6 +78,9 @@ sock::make_socket( uint16_t i_port )
name.sin_family = AF_INET;
name.sin_port = htons (i_port);
name.sin_addr.s_addr = htonl (INADDR_ANY);
+ int optval=1;
+
+ setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char*)&optval, sizeof(int));
if (bind (sock, (struct sockaddr *) &name, sizeof (name)) < 0)
{
@@ -165,18 +97,13 @@ sock::make_socket( uint16_t i_port )
}
int
-sock::read_write( int i_sock )
+sock::read_write( thrd* p_thrd, int i_sock )
{
-#ifdef VERBOSE_
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "sock::read_write( " << i_sock << " )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
char c_req[2048];
+
int i_bytes;
i_bytes = read (i_sock, c_req, 2048);
-
+
if (i_bytes < 0)
{
cerr << "Sock: read error " << endl;
@@ -189,18 +116,16 @@ sock::read_write( int i_sock )
// get the s_rep ( HTML response which will be send imediatly to the client
// and fill map_params with request values.
- string s_rep = req_parser->parse( string( c_req ), map_params );
+ auto string s_temp=(string)c_req;
+
+ string s_rep = req_parser->parse( p_thrd, string( c_req ), map_params );
// send s_rep to the client.
send( i_sock, s_rep.c_str(), s_rep.size(), 0 );
// prove if this is a request for a chat stream!
if ( map_params["event"] == "stream" )
-#ifdef THRDMOD
chat_stream( i_sock, map_params );
-#else
- chat_stream( i_sock, map_params, thrd_pool );
-#endif
return 0;
}
@@ -208,36 +133,10 @@ sock::read_write( int i_sock )
return -1;
}
-void
-sock::refill_thrd_pool( )
-{
-#ifdef VERBOSE_
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "sock::refill_thrd_pool( )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-#ifdef _VERBOSE
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << THRPOOL << i_thrd_pool_size << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
- for (int i=0; i<i_thrd_pool_size; i++ )
- {
- pthread_t new_thread;
- thrd_pool.push( new_thread );
- }
-}
-
int
sock::start()
{
-#ifdef VERBOSE_
- cout << "sock::start( )" << endl;
-#endif
-
- i_thrd_pool_size = TOOL::string2int( CONF::get().get_val( "THRDPOOL" ) );
- auto int i_port = TOOL::string2int( CONF::get().get_val( "SRVRPORT" ) );
+ auto int i_port = TOOL::string2int( CONF::get().get_val( "SRVRPORT" ) );
int sock;
fd_set active_fd_set, read_fd_set;
@@ -309,36 +208,7 @@ sock::start()
else
{
- // create a client thread object. this one will contain all data which is needed by a new posix
- // thread in order to do its tasks. the thr_client pointer will be passed to the posix function
- // there the life of a new thread begins.
- thrd* thr_client = new thrd( i );
-
- // if the thread pool is empty refill it.
- if ( thrd_pool.empty() )
- refill_thrd_pool( );
-
-#ifndef THRDMOD
- posix_thread_func( (void*) thr_client );
-
-#else
-#ifdef _VERBOSE
- cout << THREAD1 << endl;
-#endif
-
- // creating a new posix thread.
- auto int i_fail = pthread_create( &thrd_pool.front(), NULL, posix_thread_func, (void*) thr_client );
-
- // remove this thread from thread pool because its now in use.
- thrd_pool.pop();
- // check if the thread started correctly.
- if ( i_fail )
- {
- cerr << "Thrd: error with return code " << i_fail << endl;
- close ( i );
- }
-
-#endif
+ thrd_pool->run( (void*) new thrd( i ) );
FD_CLR( i, &active_fd_set );
}
}
diff --git a/sock.h b/sock.h
index 9893007..abb5878 100644..100755
--- a/sock.h
+++ b/sock.h
@@ -15,6 +15,7 @@
#include <unistd.h>
#include "incl.h"
+#include "pool.h"
#include "reqp.h"
#include "thrd.h"
@@ -25,23 +26,16 @@ class sock
private:
// total number of server requests.
unsigned long long int i_req;
- queue<pthread_t> thrd_pool;
-
- int i_thrd_pool_size;
bool b_run; // true while socket manager is running.
reqp* req_parser; // parses the http requests from clients.
+ pool* thrd_pool; // the thread pool.
// the chat stream there all the chat messages will sent through.
-#ifdef THRDMOD
static void chat_stream( int i_sock, map_string &map_params );
-#else
- static void chat_stream( int i_sock, map_string &map_params, queue<pthread_t> &thrd_pool );
-#endif
- virtual int make_socket( uint16_t port );
- static void *posix_thread_func ( void *v_pointer );
- static void *posix_thread_func_( void *v_pointer );
+ // creates a server socket.
+ virtual int make_socket( uint16_t port );
public:
// small inline methods:
@@ -50,10 +44,8 @@ public:
// public methods.
explicit sock( ); // simple constructor.
- virtual int read_write( int filedes );
+ virtual int read_write( thrd* p_thrd, int filedes );
virtual int start();
-
- virtual void refill_thrd_pool( ); // refills the thread pool with new thewads.
};
#endif
diff --git a/thrd.cpp b/thrd.cpp
index 14a804c..7c9be50 100644..100755
--- a/thrd.cpp
+++ b/thrd.cpp
@@ -4,43 +4,24 @@
#define THRD_CXX
#include "thrd.h"
-#include "MUTX.h"
#include "SOCK.h"
using namespace std;
thrd::thrd( int i_sock )
{
-#ifdef VERBOSE
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "thrd::thrd( " << i_sock << " )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
this->i_sock = i_sock;
}
thrd::~thrd()
{
-#ifdef VERBOSE
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "thrd::~thrd()" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
shutdown ( get_sock() , 2 );
}
void
thrd::run()
{
-#ifdef VERBOSE_
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "thrd::run()" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
- SOCK::get().read_write( i_sock );
+ SOCK::get().read_write( this, i_sock );
}
#endif
diff --git a/thrd.h b/thrd.h
index fecdb49..fecdb49 100644..100755
--- a/thrd.h
+++ b/thrd.h
diff --git a/todo.txt b/todo.txt
index 47869ce..47869ce 100644..100755
--- a/todo.txt
+++ b/todo.txt
diff --git a/user.cpp b/user.cpp
index 3d981b0..5a4068b 100644..100755
--- a/user.cpp
+++ b/user.cpp
@@ -5,40 +5,29 @@
#include "user.h"
#include "CONF.h"
-#include "MUTX.h"
#include "TOOL.h"
using namespace std;
user::user( string s_name ) : name( s_name )
{
-#ifdef VERBOSE
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "user::user( string \"" << s_name << "\" )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
this -> b_online = true;
this -> l_time = TOOL::unixtime();
this -> s_col1 = CONF::get().get_val( "USERCOL1" );
pthread_mutex_init( &mut_b_online, NULL);
+ pthread_mutex_init( &mut_i_sock , NULL);
pthread_mutex_init( &mut_l_time , NULL);
- pthread_mutex_init( &mut_p_room , NULL);
- pthread_mutex_init( &mut_s_mess, NULL);
+ pthread_mutex_init( &mut_p_room , NULL);
+ pthread_mutex_init( &mut_s_mess , NULL);
pthread_cond_init ( &cond_message, NULL);
- pthread_mutex_init( &mut_message, NULL);
+ pthread_mutex_init( &mut_message , NULL);
}
user::~user()
{
-#ifdef VERBOSE
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "user::~user[ \"" << get_name() << "\" ]" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
pthread_mutex_destroy( &mut_b_online );
+ pthread_mutex_destroy( &mut_i_sock );
pthread_mutex_destroy( &mut_l_time );
pthread_mutex_destroy( &mut_p_room );
pthread_mutex_destroy( &mut_s_mess );
@@ -49,12 +38,6 @@ user::~user()
void
user::get_data( map_string *p_map_data )
{
-#ifdef VERBOSE_
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "user::get_data( map_string* )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
string s_req = (*p_map_data)["!get"];
// get the nick and the color of the user.
@@ -65,12 +48,6 @@ user::get_data( map_string *p_map_data )
string
user::get_mess( )
{
-#ifdef VERBOSE_
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "user::get_mess( )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
string s_ret( "" );
pthread_mutex_lock ( &mut_s_mess );
s_ret.append( s_mess );
@@ -83,12 +60,6 @@ user::get_mess( )
bool
user::get_online( )
{
-#ifdef VERBOSE_
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "user::get_online( )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
bool b_ret;
pthread_mutex_lock ( &mut_b_online );
b_ret = b_online;
@@ -99,12 +70,6 @@ user::get_online( )
void
user::set_online( bool b_online )
{
-#ifdef VERBOSE_
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "user::set_online( bool )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
pthread_mutex_lock ( &mut_b_online );
this -> b_online = b_online;
pthread_mutex_unlock( &mut_b_online );
@@ -113,12 +78,6 @@ user::set_online( bool b_online )
room*
user::get_p_room( )
{
-#ifdef VERBOSE_
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "user::get_p_room( )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
room* p_return;
pthread_mutex_lock ( &mut_p_room );
p_return = p_room;
@@ -129,25 +88,32 @@ user::get_p_room( )
void
user::set_p_room( room* p_room )
{
-#ifdef VERBOSE_
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "user::set_p_room( void* )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
pthread_mutex_lock ( &mut_p_room );
this -> p_room = p_room;
pthread_mutex_unlock( &mut_p_room );
}
+int
+user::get_sock( )
+{
+ int i_ret;
+ pthread_mutex_lock ( &mut_i_sock );
+ i_ret = i_sock;
+ pthread_mutex_unlock( &mut_i_sock );
+ return i_ret;
+}
+
+void
+user::set_sock( int i_sock )
+{
+ pthread_mutex_lock ( &mut_i_sock );
+ this -> i_sock = i_sock;
+ pthread_mutex_unlock( &mut_i_sock );
+}
+
void
user::renew_stamp( )
{
-#ifdef VERBOSE_
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "user::renew_stamp( )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
pthread_mutex_lock ( &mut_l_time );
l_time = TOOL::unixtime();
pthread_mutex_unlock( &mut_l_time );
@@ -156,12 +122,6 @@ user::renew_stamp( )
void
user::msg_post( string *p_msg )
{
-#ifdef VERBOSE_
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "user::msg_post_( string* )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
pthread_mutex_lock ( &mut_s_mess );
s_mess.append( *p_msg );
pthread_mutex_unlock( &mut_s_mess );
@@ -172,12 +132,6 @@ user::msg_post( string *p_msg )
void
user::get_user_list( string &s_list, string &s_seperator )
{
-#ifdef VERBOSE_
- pthread_mutex_lock ( &MUTX::get().mut_stdout );
- cout << "user::get_user_list( string &s_list, string &s_seperator )" << endl;
- pthread_mutex_unlock( &MUTX::get().mut_stdout );
-#endif
-
s_list.append( "<font color=\"" )
.append( get_col1() )
.append( "\">" )
diff --git a/user.h b/user.h
index cc7bf91..1bdd79e 100644..100755
--- a/user.h
+++ b/user.h
@@ -26,6 +26,7 @@ private:
room* p_room; // pointer to the user's room.
pthread_mutex_t mut_b_online;
+ pthread_mutex_t mut_i_sock;
pthread_mutex_t mut_l_time;
pthread_mutex_t mut_s_mess;
pthread_mutex_t mut_p_room;
@@ -38,9 +39,6 @@ public:
string get_col1() const { return s_col1; }
void set_col1 ( string s_col1 ) { this -> s_col1 = s_col1; }
- int get_sock() const { return i_sock; }
- void set_sock ( int i_sock ) { this -> i_sock = i_sock; }
-
rang get_rang ( ) const { return r_rang; }
void set_rang ( rang r_rang ) { r_oldr = this -> r_rang;
this -> r_rang = r_rang; }
@@ -60,6 +58,9 @@ public:
virtual void set_online( bool b_online );
virtual room* get_p_room();
virtual void set_p_room( room* p_room );
+ virtual int get_sock ( );
+ virtual void set_sock ( int i_sock );
+
virtual void renew_stamp();