bugs fixed of passing parameter values

master
xieguigang 5 years ago
parent 7cc42d9761
commit 4593da7ccd

@ -85,6 +85,10 @@ Public Class IDelegate
Call Me.New(target.Method)
End Sub
''' <summary>
''' is static or instance method?
''' </summary>
''' <returns></returns>
Public Function GetMethodTarget() As Object
Dim type As Type = provideType()

@ -1,49 +1,49 @@
#Region "Microsoft.VisualBasic::596f11e06500e4ccde1801ae45c85a3e, Parallel\IpcParallel\IPCSocket.vb"
' Author:
'
' asuka (amethyst.asuka@gcmodeller.org)
' xie (genetics@smrucc.org)
' xieguigang (xie.guigang@live.com)
'
' Copyright (c) 2018 GPL3 Licensed
'
'
' GNU GENERAL PUBLIC LICENSE (GPL3)
'
'
' This program is free software: you can redistribute it and/or modify
' it under the terms of the GNU General Public License as published by
' the Free Software Foundation, either version 3 of the License, or
' (at your option) any later version.
'
' This program is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' GNU General Public License for more details.
'
' You should have received a copy of the GNU General Public License
' along with this program. If not, see <http://www.gnu.org/licenses/>.
' /********************************************************************************/
' Summaries:
' Class IPCSocket
'
' Properties: handleError, handleGetArgument, handlePOSTResult, host, HostPort
' nargs, Protocol
'
' Constructor: (+1 Overloads) Sub New
'
' Function: GetArgumentByIndex, GetArgumentNumber, GetFirstAvailablePort, GetTask, PostError
' PostResult, PostStart, Run
'
' Sub: [Stop]
'
' /********************************************************************************/
' Author:
'
' asuka (amethyst.asuka@gcmodeller.org)
' xie (genetics@smrucc.org)
' xieguigang (xie.guigang@live.com)
'
' Copyright (c) 2018 GPL3 Licensed
'
'
' GNU GENERAL PUBLIC LICENSE (GPL3)
'
'
' This program is free software: you can redistribute it and/or modify
' it under the terms of the GNU General Public License as published by
' the Free Software Foundation, either version 3 of the License, or
' (at your option) any later version.
'
' This program is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' GNU General Public License for more details.
'
' You should have received a copy of the GNU General Public License
' along with this program. If not, see <http://www.gnu.org/licenses/>.
' /********************************************************************************/
' Summaries:
' Class IPCSocket
'
' Properties: handleError, handleGetArgument, handlePOSTResult, host, HostPort
' nargs, Protocol
'
' Constructor: (+1 Overloads) Sub New
'
' Function: GetArgumentByIndex, GetArgumentNumber, GetFirstAvailablePort, GetTask, PostError
' PostResult, PostStart, Run
'
' Sub: [Stop]
'
' /********************************************************************************/
#End Region
@ -52,6 +52,7 @@ Imports System.Text
Imports Microsoft.VisualBasic.ComponentModel
#If netcore5 = 1 Then
Imports Microsoft.VisualBasic.ComponentModel.Collection
Imports Microsoft.VisualBasic.Linq
#End If
Imports Microsoft.VisualBasic.Net.Protocols.Reflection
Imports Microsoft.VisualBasic.Net.Tcp
@ -155,7 +156,7 @@ Public Class IPCSocket : Implements ITaskDriver
<Protocol(Protocols.PostError)>
Public Function PostError(request As RequestStream, remoteAddress As System.Net.IPEndPoint) As BufferPipe
Using ms As New MemoryStream(request.ChunkBuffer)
Call _handleError(host.streamBuf.handleCreate(ms, GetType(IPCError), StreamMethods.Auto))
Call DirectCast(SlaveTask.GetValueFromStream(ms, GetType(IPCError), host.streamBuf), IPCError).DoCall(_handleError)
End Using
Return New DataPipe(Encoding.ASCII.GetBytes("OK!"))

@ -65,6 +65,7 @@ Public Class SlaveTask
Friend ReadOnly streamBuf As New StreamEmit
<DebuggerStepThrough>
Sub New(processor As InteropService, cli As ISlaveTask,
Optional debugPort As Integer? = Nothing,
Optional ignoreError As Boolean = False)
@ -93,15 +94,18 @@ Public Class SlaveTask
''' <param name="debugCode"></param>
''' <returns></returns>
Private Function handlePOST(buf As Stream, type As Type, debugCode As Integer) As Object
Call Console.WriteLine($"[{debugCode.ToHexString}] task finished!")
Return GetValueFromStream(buf, type, streamBuf)
End Function
Friend Shared Function GetValueFromStream(buf As Stream, type As Type, streamBuf As StreamEmit) As Object
Dim obj As New ObjectStream(buf)
Dim socket As SocketRef = SocketRef.GetSocket(obj)
obj = socket.Open
Call Console.WriteLine($"[{debugCode.ToHexString}] task finished!")
Using file As MemoryStream = obj.openMemoryBuffer
Return streamBuf.handleCreate(buf, type, obj.method)
Return streamBuf.handleCreate(file, type, obj.method)
End Using
End Function

@ -63,6 +63,7 @@ Public Class TaskBuilder : Implements ITaskDriver
ReadOnly masterPort As Integer
ReadOnly emit As New StreamEmit
<DebuggerStepThrough>
Sub New(port As Integer)
masterPort = port
End Sub

Loading…
Cancel
Save