Minor updates:
- CSelectableCore: - Allow ForkPipeHandle to change ExecPath - Remove parent/child process test comments - Move FD operations methods from private -> public
This commit is contained in:
@@ -183,7 +183,7 @@ bool CSelectableCore::SetPortHandle( THandle * Handle, const char * FileName )
|
||||
bool CSelectableCore::SetForkPipeHandle( THandle * Handle, const char * ExecPath )
|
||||
{
|
||||
// Validate
|
||||
if (!Handle || (Handle->Type != ctNone) || !ExecPath) {
|
||||
if (!Handle || ((Handle->Type != ctNone) && (Handle->Type != ctForkPipe)) || !ExecPath) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -405,16 +405,12 @@ int CSelectableCore::OpenForkPipe( THandle * Handle )
|
||||
close( pipefd[0] );
|
||||
Handle->FD = pipefd[1];
|
||||
|
||||
write( Handle->FD, "testing\n", 8 );
|
||||
|
||||
// Log event
|
||||
if (Log) Log->Message( DebugLevel, dlMedium, "%s: Handle '%s' - Process forked successfully", Name, Handle->Name );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Fork success - this is child
|
||||
printf( "child\n" );
|
||||
|
||||
// Replace stdin with Read-end of pipe
|
||||
close( 0 );
|
||||
dup( pipefd[0] );
|
||||
|
||||
@@ -186,11 +186,6 @@ protected:
|
||||
virtual int OpenClientSocket( THandle * Handle );
|
||||
|
||||
// Mutual Operations
|
||||
virtual int Open( THandle * Handle );
|
||||
virtual bool Close( THandle * Handle, bool CloseChildren = false );
|
||||
virtual bool Read( THandle * Handle );
|
||||
virtual bool Write( THandle * Handle );
|
||||
|
||||
int ReadFromFD( int FD, char * Data, int MaxLen );
|
||||
int WriteToFD( int FD, const char * Data, int Len, bool Force );
|
||||
|
||||
@@ -235,6 +230,12 @@ public:
|
||||
bool SetSocketHandle( THandle * Handle, EConnectType Type, const char * Address, const int PortNo, bool KeepAlive );
|
||||
bool ClearHandle( THandle * Handle );
|
||||
|
||||
// FD Operations
|
||||
virtual int Open( THandle * Handle );
|
||||
virtual bool Close( THandle * Handle, bool CloseChildren = false );
|
||||
virtual bool Read( THandle * Handle );
|
||||
virtual bool Write( THandle * Handle );
|
||||
|
||||
// FD operations
|
||||
inline virtual int Open( const char * HandleName ) { return (Open( GetHandle( HandleName ))); };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user