failed to connect error replacement
This commit is contained in:
parent
6f8896d0ab
commit
c74d5584b0
|
|
@ -15,8 +15,6 @@ type SMPPClient struct {
|
||||||
|
|
||||||
func NewSMPPClient(cfg *config.Config) (*SMPPClient, error) {
|
func NewSMPPClient(cfg *config.Config) (*SMPPClient, error) {
|
||||||
smppCfg := cfg.SMPP
|
smppCfg := cfg.SMPP
|
||||||
log.Println("SMPP Config:", smppCfg) // This will print the SMPP configuration
|
|
||||||
|
|
||||||
tx := &smpp.Transceiver{
|
tx := &smpp.Transceiver{
|
||||||
Addr: smppCfg.Addr,
|
Addr: smppCfg.Addr,
|
||||||
User: smppCfg.User,
|
User: smppCfg.User,
|
||||||
|
|
@ -24,16 +22,12 @@ func NewSMPPClient(cfg *config.Config) (*SMPPClient, error) {
|
||||||
Handler: func(p pdu.Body) {},
|
Handler: func(p pdu.Body) {},
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Println("Attempting to bind to SMPP server at address:", smppCfg.Addr)
|
|
||||||
|
|
||||||
connStatus := tx.Bind()
|
connStatus := tx.Bind()
|
||||||
go func() {
|
status := <-connStatus
|
||||||
for c := range connStatus {
|
if status.Status() != smpp.Connected {
|
||||||
if c.Status() != smpp.Connected {
|
log.Println("Failed to connect:", status.Error())
|
||||||
log.Println("Failed to connect:", c.Error())
|
return nil, status.Error()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
return &SMPPClient{Transceiver: tx}, nil
|
return &SMPPClient{Transceiver: tx}, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue