mirror of
https://github.com/qtgolang/SunnyNet.git
synced 2026-08-30 22:11:29 -07:00
2026-03-23
This commit is contained in:
@@ -108,6 +108,13 @@ func (s *proxyRequest) CallbackTCPRequest(callType int, _msg *public.TcpMsg, Rem
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if callType == public.SunnyNetMsgTypeTCPClientSend || callType == public.SunnyNetMsgTypeTCPAboutToConnect {
|
||||
s.TCP.Send = msg
|
||||
} else {
|
||||
s.TCP.Receive = msg
|
||||
}
|
||||
|
||||
if s.TcpCall < 10 {
|
||||
if s.TcpGoCall != nil {
|
||||
s.TcpGoCall(m)
|
||||
@@ -122,19 +129,14 @@ func (s *proxyRequest) CallbackTCPRequest(callType int, _msg *public.TcpMsg, Rem
|
||||
return
|
||||
}
|
||||
if callType == public.SunnyNetMsgTypeTCPConnectOK {
|
||||
Call.Call(s.TcpCall, s.Global.SunnyContext, LocalAddr, hostname, int(callType), MessageId, msg.Data.Bytes(), msg.Data.Len(), s.Theology, pid)
|
||||
Call.Call(s.TcpCall, s.Global.SunnyContext, LocalAddr, hostname, callType, MessageId, msg.Data.Bytes(), msg.Data.Len(), s.Theology, pid)
|
||||
return
|
||||
}
|
||||
if callType == public.SunnyNetMsgTypeTCPClose {
|
||||
Call.Call(s.TcpCall, s.Global.SunnyContext, LocalAddr, hostname, int(callType), MessageId, []byte{}, 0, s.Theology, pid)
|
||||
Call.Call(s.TcpCall, s.Global.SunnyContext, LocalAddr, hostname, callType, MessageId, []byte{}, 0, s.Theology, pid)
|
||||
return
|
||||
}
|
||||
if callType == public.SunnyNetMsgTypeTCPClientSend || callType == public.SunnyNetMsgTypeTCPAboutToConnect {
|
||||
s.TCP.Send = msg
|
||||
} else {
|
||||
s.TCP.Receive = msg
|
||||
}
|
||||
Call.Call(s.TcpCall, s.Global.SunnyContext, LocalAddr, hostname, int(callType), MessageId, msg.Data.Bytes(), msg.Data.Len(), s.Theology, pid)
|
||||
Call.Call(s.TcpCall, s.Global.SunnyContext, LocalAddr, hostname, callType, MessageId, msg.Data.Bytes(), msg.Data.Len(), s.Theology, pid)
|
||||
}
|
||||
func (s *proxyRequest) UpdateRawTarget(i uint32) {
|
||||
s.rawTarget = i
|
||||
@@ -211,6 +213,7 @@ func (s *proxyRequest) CallbackBeforeRequest() {
|
||||
err := ""
|
||||
if m._Break {
|
||||
err = debug
|
||||
m._err = debug
|
||||
}
|
||||
|
||||
if s.HttpCall < 10 {
|
||||
@@ -274,6 +277,7 @@ func (s *proxyRequest) CallbackBeforeResponse() {
|
||||
err := ""
|
||||
if m._Break {
|
||||
err = debug
|
||||
m._err = debug
|
||||
}
|
||||
if s.HttpCall < 10 {
|
||||
if s.HttpGoCall != nil {
|
||||
@@ -387,7 +391,7 @@ func (s *proxyRequest) CallbackError(err string) {
|
||||
if s.Request.URL != nil {
|
||||
Url = s.Request.URL.String()
|
||||
}
|
||||
Call.Call(s.HttpCall, s.Global.SunnyContext, s.Theology, MessageId, int(public.HttpRequestFail), Method, Url, err, pid)
|
||||
Call.Call(s.HttpCall, s.Global.SunnyContext, s.Theology, MessageId, public.HttpRequestFail, Method, Url, err, pid)
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ func Call(address int, arg ...interface{}) int {
|
||||
}
|
||||
var ret = uintptr(0)
|
||||
ch <- true
|
||||
ret, _, _ = syscall.Syscall18(uintptr(address), uintptr(Len), args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13], args[14], args[15], args[16], args[17])
|
||||
ret, _, _ = syscall.SyscallN(uintptr(address), uintptr(Len), args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13], args[14], args[15], args[16], args[17])
|
||||
<-ch
|
||||
for index := 0; index < len(Frees); index++ {
|
||||
C.free(unsafe.Pointer(Frees[index]))
|
||||
|
||||
@@ -220,13 +220,8 @@ func GoHTTPRequest(method, url string, data any, header ...any) ([]byte, http.He
|
||||
case []byte:
|
||||
rBody = v
|
||||
break
|
||||
|
||||
}
|
||||
rData := io.NopCloser(bytes.NewBuffer(rBody))
|
||||
defer func() {
|
||||
_ = rData.Close()
|
||||
}()
|
||||
request, err := http.NewRequest(strings.ToUpper(method), url, rData)
|
||||
request, err := http.NewRequest(strings.ToUpper(method), url, bytes.NewBuffer(rBody))
|
||||
if len(header) > 0 {
|
||||
h, ok := header[0].(Header)
|
||||
if ok {
|
||||
|
||||
Reference in New Issue
Block a user