本文整理汇总了Golang中github.com/desertbit/glue/backend.BackendSocket.Close方法的典型用法代码示例。如果您正苦于以下问题:Golang BackendSocket.Close方法的具体用法?Golang BackendSocket.Close怎么用?Golang BackendSocket.Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/desertbit/glue/backend.BackendSocket
的用法示例。
在下文中一共展示了BackendSocket.Close方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: handleOnNewSocketConnection
func (s *Server) handleOnNewSocketConnection(bs backend.BackendSocket) {
// Close the socket if incomming connections should be blocked.
if s.IsBlocked() {
bs.Close()
return
}
// Create a new socket value.
// The goroutines are started automatically.
newSocket(s, bs)
}
示例2: onNewSocketConnection
func onNewSocketConnection(bs backend.BackendSocket) {
// Close the socket if incomming connections should be blocked.
if block {
bs.Close()
return
}
// Create a new socket value.
// The goroutines are started automatically.
newSocket(bs)
}
示例3: onNewSocketConnection
func onNewSocketConnection(bs backend.BackendSocket) {
// Close the socket if incomming connections should be blocked.
if block {
bs.Close()
return
}
// Create a new socket value.
s := newSocket(bs)
func() {
// Recover panics and log the error.
defer func() {
if e := recover(); e != nil {
log.L.Errorf("glue: panic while calling on new socket function: %v\n%s", e, debug.Stack())
}
}()
// Trigger the on new socket event function.
onNewSocket(s)
}()
}