some renaming

This commit is contained in:
Egor Aristov 2026-03-28 14:47:47 +03:00
parent c242c72f3d
commit 4010408b08
2 changed files with 21 additions and 21 deletions

View File

@ -33,7 +33,7 @@ type ipcCommon struct {
errCh chan error
nextId int64
pendingCalls map[int64]*pendingCall
processingCalls atomic.Int64
processingIncomingCalls atomic.Int64
stopRequested atomic.Bool
mu sync.Mutex
writeMu sync.Mutex
@ -50,17 +50,17 @@ func (ipc *ipcCommon) readConn() {
ipc.raiseErr(fmt.Errorf("unmarshal message: %w", err))
break
}
ipc.processMsg(msg)
ipc.handleIncomingMsg(msg)
}
if err := scn.Err(); err != nil {
ipc.raiseErr(err)
}
}
func (ipc *ipcCommon) processMsg(msg Message) {
func (ipc *ipcCommon) handleIncomingMsg(msg Message) {
switch msg.Type {
case MsgCall:
go ipc.handleCall(msg)
go ipc.handleIncomingCall(msg)
case MsgResponse:
ipc.handleResponse(msg)
}
@ -83,13 +83,13 @@ func (ipc *ipcCommon) sendMsg(msg Message) error {
return nil
}
func (ipc *ipcCommon) handleCall(msg Message) {
func (ipc *ipcCommon) handleIncomingCall(msg Message) {
if ipc.stopRequested.Load() {
return
}
ipc.processingCalls.Add(1)
defer ipc.processingCalls.Add(-1)
ipc.processingIncomingCalls.Add(1)
defer ipc.processingIncomingCalls.Add(-1)
defer func() {
if err := recover(); err != nil {
@ -126,12 +126,12 @@ func (ipc *ipcCommon) handleCall(msg Message) {
results = append(results, resVal.Interface())
}
var resErr error
var resultError error
if !errResultVals.IsNil() {
resErr = errResultVals.Interface().(error)
resultError = errResultVals.Interface().(error)
}
ipc.sendResponse(msg.Id, results, resErr)
ipc.sendResponse(msg.Id, results, resultError)
}
func (ipc *ipcCommon) findMethod(methodName string) (reflect.Value, error) {

View File

@ -111,7 +111,7 @@ func (p *ParentIPC) Stop() error {
if hasPending {
return fmt.Errorf("there are calls pending")
}
if p.processingCalls.Load() > 0 {
if p.processingIncomingCalls.Load() > 0 {
return fmt.Errorf("there are calls processing")
}
p.stopRequested.Store(true)