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