Ver código fonte

add support hub as client-side

joe 4 anos atrás
pai
commit
8b97aad459
4 arquivos alterados com 8 adições e 2 exclusões
  1. 1 2
      .gitignore
  2. 4 0
      cpn/hub.go
  3. 1 0
      cpn/server_tcp.go
  4. 2 0
      ihub.go

+ 1 - 2
.gitignore

@@ -1,4 +1,3 @@
 .idea/
 .vscode/
-sample/tcpd
-sample/wsd
+sample/echo

+ 4 - 0
cpn/hub.go

@@ -131,3 +131,7 @@ func (self *Hub) GetSessionNum() int {
 	defer self.Unlock()
 	return len(self.sess)
 }
+
+func (self *Hub) NewConnection(string, uint64) error {
+	return nil
+}

+ 1 - 0
cpn/server_tcp.go

@@ -50,6 +50,7 @@ func (self *TcpServer) Start() error {
 func (self *TcpServer) DoJob(int) {
 
 }
+
 func (self *TcpServer) Stop() error {
 	close(self.chQuit)
 	self.wg.Wait() //保证 Start 完全退出

+ 2 - 0
ihub.go

@@ -42,6 +42,8 @@ type IHub interface {
 	Stop() error  // stop hub
 	DoJob(int)    // not used now
 
+	NewConnection(string, uint64) error
+
 	PutSession(uint64, ISession) error // session management base on id
 	DelSession(uint64) error
 	GetSession(uint64) (ISession, error)