Comments (10)
Hello @YiuTerran ,
probably I can append tp protocol auto-intialization also in the Send
message... And I hope it will not break anything.
This change should allow sending SIP requests without listeners setup, but sure will correctly work only with reliable transports
from gosip.
I just use a mock Listener
for my purpose:
type Listener struct {
network string
addr net.Addr
ch chan net.Conn
}
func ListenTCP(network string, addr *net.TCPAddr) (net.Listener, error) {
return &Listener{
network: network,
addr: addr,
ch: make(chan net.Conn, 1),
}, nil
}
// Accept never return
func (l Listener) Accept() (net.Conn, error) {
return <-l.ch, io.EOF
}
func (l Listener) Close() error {
defer func() {
if i := recover(); i != nil {
//just ignore
}
}()
close(l.ch)
return nil
}
func (l Listener) Addr() net.Addr {
return l.addr
}
from gosip.
@YiuTerran I have pushed a patch to the dev
branch. Can you try it in your app/env?
You can install it with go get github.com/ghettovoice/gosip@dev
from gosip.
@YiuTerran I have pushed a patch to the
dev
branch. Can you try it in your app/env? You can install it withgo get github.com/ghettovoice/gosip@dev
ok, i will try it next week. thanks very much~
from gosip.
Sorry for late reply. I just test the dev
branch, it looks that everything is fine without listening any port when using TCP.
Thanks for your help~
from gosip.
@ghettovoice But i just review the code, found a little problem:
func (tpl *layer) getProtocol(network string) (p Protocol, err error) {
var ok bool
// not goroutine safe, we need some func like `LoadOrStore` here
p, ok = tpl.protocols.get(protocolKey(network))
if ok {
return
}
p, err = protocolFactory(
network,
tpl.pmsgs,
tpl.perrs,
tpl.canceled,
tpl.msgMapper,
tpl.Log(),
)
if err != nil {
return nil, err
}
tpl.protocols.put(protocolKey(p.Network()), p)
return p, nil
}
from gosip.
tpl.protocols
points to internal map+mutex store
from gosip.
tpl.protocols
points to internal map+mutex store
Yeah, but data race happens between get
and put
. It's not a big problem.
from gosip.
Ah, I see now. Do you talking about that get and put should be made as single "atomic" action?
from gosip.
Ah, I see now. Do you talking about that get and put should be made as single "atomic" action?
Yeah, maybe it's betterπ
from gosip.
Related Issues (20)
- Parser fully ignore the rules for character escaping/unescaping HOT 2
- [BUG] panic error HOT 3
- sip server blocked while receiving a large UDP message HOT 5
- Predefined SIP Code HOT 2
- Goroutine leaks with CANCEL HOT 2
- How to add a custom request header HOT 2
- [BUG] panic when request with empty "rport" in via header HOT 1
- how to send 487 when i recieve cancel HOT 2
- [Feature Request] Export metrics of sip server. HOT 3
- listen on both udp and tcp HOT 1
- typo HOT 1
- new goroutines for user handlers HOT 1
- received_by and received_from for multi port listening HOT 4
- AuthFromValue support value without quote HOT 1
- i got this pannic HOT 2
- gosip panic
- leak memoy HOT 1
- sip.NewAckRequest ignore body parameter HOT 4
- Add "rport" in via to support NAT HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gosip.