-
Notifications
You must be signed in to change notification settings - Fork 0
/
new_base_bng.go
33 lines (30 loc) · 1.14 KB
/
new_base_bng.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package bngsocket
import (
"bufio"
"net"
"reflect"
"sync"
"github.com/custodia-cenv/bngsocket-go/transport"
"github.com/google/uuid"
)
func _NewBaseBngSocketObject(socket net.Conn) *BngConn {
bngConn := &BngConn{
conn: socket,
writer: bufio.NewWriter(socket),
reader: bufio.NewReader(socket),
connMutex: new(sync.Mutex),
_innerhid: uuid.NewString(),
ackHandle: newConnACK(),
backgroundProcesses: &sync.WaitGroup{},
closed: newSafeBool(false),
closing: newSafeBool(false),
writerMutex: new(sync.Mutex),
functions: newSafeMap[string, reflect.Value](),
openRpcRequests: _SafeMap[string, chan *transport.RpcResponse]{Map: new(sync.Map)},
openChannelListener: newSafeMap[string, *BngConnChannelListener](),
openChannelInstances: newSafeMap[string, *BngConnChannel](),
openChannelJoinProcesses: _SafeMap[string, chan *transport.ChannelRequestResponse]{Map: new(sync.Map)},
runningError: newSafeValue[error](nil),
}
return bngConn
}