Exemplo n.º 1
0
 public virtual void  removeClient(ServerClientTransport transport)
 {
     lock (clients)
     {
         clients.Remove(transport);
         fireDisconnectedEvent(transport);
     }
 }
Exemplo n.º 2
0
 protected internal virtual void  fireDisconnectedEvent(ServerClientTransport client)
 {
     lock (listeners)
     {
         foreach (ITransportConnectionListener listener in listeners)
         {
             listener.onDisconnected(client);
         }
     }
 }
Exemplo n.º 3
0
 public virtual void acceptClient(IAsyncResult asyncResult)
 {
     lock (addr)
     {
         if (isAvailable())
         {
             try
             {
                 Socket listener = (Socket)asyncResult.AsyncState;
                 if (asyncResult.IsCompleted)
                 {
                     Socket clientSocket = listener.EndAccept(asyncResult);
                     if (clientSocket != null)
                     {
                         ServerClientTransport transport =
                             new ServerClientTransport(
                                 new Uri("bnmq://" + clientSocket.RemoteEndPoint.ToString()),
                                 this,
                                 acceptorFactory
                                 );
                         transport.setSocket(clientSocket);
                         lock (clients)
                         {
                             clients.Add(transport);
                             fireConnectedEvent(transport);
                         }
                     }
                 }
             }
             finally
             {
                 serverChannel.BeginAccept(this.acceptClient, serverChannel);
             }
         }
     }
 }
Exemplo n.º 4
0
 protected internal virtual void  fireReceivedData(MessageEnvelope message, ServerClientTransport client)
 {
     doProcessReceivedData(message, client);
 }
Exemplo n.º 5
0
 public virtual void acceptClient(IAsyncResult asyncResult)
 {
     lock (addr)
     {
         if (isAvailable())
         {
             try
             {
                 Socket listener = (Socket)asyncResult.AsyncState;
                 if (asyncResult.IsCompleted)
                 {
                     Socket clientSocket = listener.EndAccept(asyncResult);
                     if (clientSocket != null)
                     {
                         ServerClientTransport transport =
                             new ServerClientTransport(
                                 new Uri("bnmq://" + clientSocket.RemoteEndPoint.ToString()),
                             this,
                             acceptorFactory
                         );
                         transport.setSocket(clientSocket);
                         lock (clients)
                         {
                             clients.Add(transport);
                             fireConnectedEvent(transport);
                         }
                     }
                 }
             }
             finally
             {
                 serverChannel.BeginAccept(this.acceptClient, serverChannel);
             }
         }
     }
 }
Exemplo n.º 6
0
 protected internal virtual void fireReceivedData(MessageEnvelope message, ServerClientTransport client)
 {
     doProcessReceivedData(message, client);
 }
Exemplo n.º 7
0
 protected internal virtual void fireDisconnectedEvent(ServerClientTransport client)
 {
     lock(listeners)
     {
         foreach (ITransportConnectionListener listener in listeners)
         {
             listener.onDisconnected(client);
         }
     }
 }
Exemplo n.º 8
0
 public virtual void removeClient(ServerClientTransport transport)
 {
     lock (clients)
     {
         clients.Remove(transport);
         fireDisconnectedEvent(transport);
     }
 }