Skip to content

Commit

Permalink
More cleanign
Browse files Browse the repository at this point in the history
tabs to space / added roadmap to readme
  • Loading branch information
codewar65 committed Jul 15, 2017
1 parent 954866d commit f5141e3
Show file tree
Hide file tree
Showing 7 changed files with 403 additions and 380 deletions.
20 changes: 19 additions & 1 deletion README.md
Expand Up @@ -73,7 +73,8 @@ the same time.

## Running VTXServ

Type vtxserv from the command line.
Type vtxserv from the command line. Once the server is running you can enter
commands like:

START ALL : start up the web server, websocket server, and the bridge process.
The bridge process redirects StdIn/StdOut back and forth between the 'node'
Expand Down Expand Up @@ -103,3 +104,20 @@ Sample node software is in the node directory. Actual BBS software is not in the
scope of this project, but feel free to tinker, or retrofit existing packages
to work with VTX.

## Roadmap

Stablize server software - fully crashproof and able to always terminate phantom
nodes.

Add additional tool to server console for convert SVG files to Base64 for use
in node software. Possibly remove these tools to separate command line utilities.

Clean up demo node software. Develop ncurses compatible functions and procedures.

Add new escape sequences to define clickable hotspots for sending a key or string
to the server. Additionally, define hotspot for external URLs links that open in
an new page.

Investigate ability for websocket server to accept non-'user' connections from
other VTX servers for passing private network information like mail or echo-style
messages.
2 changes: 1 addition & 1 deletion bclasses.pas
Expand Up @@ -38,7 +38,7 @@ TBThread = class(TThread)
fSyncLock: TCriticalSection;
procedure Synchronize(AMethod: TThreadMethod);
public
constructor Create(CreateSuspended: Boolean);
constructor Create(CreateSuspended: Boolean);
destructor Destroy; override;
end;

Expand Down
68 changes: 34 additions & 34 deletions customserver2.pas
Expand Up @@ -31,7 +31,7 @@ interface
// Sockets,
ssl_openssl,
BClasses,
syncobjs;
syncobjs;

type
TCustomServer = class;
Expand All @@ -41,24 +41,24 @@ TCustomConnection = class;
TTCPCustomConnectionSocket = class(TTCPBlockSocket)

protected
fConnection : TCustomConnection;
fCurrentStatusReason : THookSocketReason;
fCurrentStatusValue : string;
fOnSyncStatus : THookSocketStatus;
fConnection : TCustomConnection;
fCurrentStatusReason : THookSocketReason;
fCurrentStatusValue : string;
fOnSyncStatus : THookSocketStatus;

procedure DoOnStatus(Sender: TObject; Reason: THookSocketReason; const Value: String);
procedure SyncOnStatus;
procedure DoOnStatus(Sender: TObject; Reason: THookSocketReason; const Value: String);
procedure SyncOnStatus;

public
constructor Create;
constructor Create;

destructor Destroy; override;
destructor Destroy; override;

{:Owner (@link(TCustomConnection))}
property Connection: TCustomConnection read fConnection;
property Connection: TCustomConnection read fConnection;

{:Socket status event (synchronized to main thread)}
property OnSyncStatus: THookSocketStatus read fOnSyncStatus write fOnSyncStatus;
property OnSyncStatus: THookSocketStatus read fOnSyncStatus write fOnSyncStatus;
end;


Expand All @@ -75,50 +75,50 @@ TCustomConnection = class(TBThread)
private

protected
fIndex : integer;
fParent : TCustomServer;
fSocket : TTCPCustomConnectionSocket;
fSSL : boolean;
procedure AfterConnectionExecute; virtual;
function BeforeExecuteConnection: boolean; virtual;
procedure ExecuteConnection; virtual;
function GetIsTerminated: boolean;
fIndex : integer;
fParent : TCustomServer;
fSocket : TTCPCustomConnectionSocket;
fSSL : boolean;
procedure AfterConnectionExecute; virtual;
function BeforeExecuteConnection: boolean; virtual;
procedure ExecuteConnection; virtual;
function GetIsTerminated: boolean;

public
constructor Create(aSocket: TTCPCustomConnectionSocket); virtual;
destructor Destroy; override;
constructor Create(aSocket: TTCPCustomConnectionSocket); virtual;
destructor Destroy; override;

{:Thread execute method}
procedure Execute; override;
procedure Execute; override;

{:Thread resume method}
procedure Start;
procedure Start;
{:Thread suspend method}
procedure Stop;
procedure Stop;

{:Temination procedure
One should call this procedure to terminate thread,
it internally calls Terminate, but can be overloaded,
and can be used for clean um }
procedure TerminateThread; virtual;
procedure TerminateThread; virtual;

{:@Connection index.
Automatically generated. }
property Index: integer read fIndex;
property Index: integer read fIndex;

{:@True if thread is not terminated and @link(Socket) exists}
property IsTerminated: boolean read GetIsTerminated;
property IsTerminated: boolean read GetIsTerminated;

{:@Connection parent
If client connection, this property is always nil, if server
connection, this property is @link(TCustomServer) that created this connection }
property Parent: TCustomServer read fParent;
property Parent: TCustomServer read fParent;

{:@Connection socket}
property Socket: TTCPCustomConnectionSocket read fSocket;
property Socket: TTCPCustomConnectionSocket read fSocket;

{:Whether SSL is used}
property SSL: boolean read fSSL write fSSL;
property SSL: boolean read fSSL write fSSL;
end;


Expand Down Expand Up @@ -243,7 +243,7 @@ TCustomServer = class(TBThread)
This method should be called instead of Terminate to terminate thread,
it internally calls Terminate, but can be overloaded,
and can be used for data clean up
}
}
procedure TerminateThread; virtual;


Expand Down Expand Up @@ -704,7 +704,7 @@ procedure TTCPCustomConnectionSocket.DoOnStatus(Sender: TObject; Reason: THookSo
fCurrentStatusReason := Reason;
fCurrentStatusValue := value;
fConnection.Synchronize(SyncOnStatus);

{
if (fCurrentStatusReason = HR_Error) and (LastError = WSAECONNRESET) then
fConnection.Terminate;
Expand Down Expand Up @@ -744,7 +744,7 @@ destructor TCustomConnection.Destroy;
fSocket.OnStatus := nil;
fSocket.Free;
end;

inherited Destroy;
end;

Expand Down Expand Up @@ -774,7 +774,7 @@ procedure TCustomConnection.Stop;
procedure TCustomConnection.TerminateThread;
begin
if (terminated) then exit;

Socket.OnSyncStatus := nil;
Socket.OnStatus := nil;
Terminate;
Expand Down

0 comments on commit f5141e3

Please sign in to comment.