Esempio n. 1
0
 public virtual void  removeClient(ServerClientTransport transport)
 {
     lock (clients)
     {
         clients.Remove(transport);
         fireDisconnectedEvent(transport);
     }
 }
Esempio n. 2
0
 protected internal virtual void  fireDisconnectedEvent(ServerClientTransport client)
 {
     lock (listeners)
     {
         foreach (ITransportConnectionListener listener in listeners)
         {
             listener.onDisconnected(client);
         }
     }
 }
Esempio 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);
             }
         }
     }
 }
Esempio n. 4
0
 protected internal virtual void  fireReceivedData(MessageEnvelope message, ServerClientTransport client)
 {
     doProcessReceivedData(message, client);
 }
Esempio 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);
             }
         }
     }
 }
Esempio n. 6
0
 protected internal virtual void fireReceivedData(MessageEnvelope message, ServerClientTransport client)
 {
     doProcessReceivedData(message, client);
 }
Esempio n. 7
0
 protected internal virtual void fireDisconnectedEvent(ServerClientTransport client)
 {
     lock(listeners)
     {
         foreach (ITransportConnectionListener listener in listeners)
         {
             listener.onDisconnected(client);
         }
     }
 }
Esempio n. 8
0
 public virtual void removeClient(ServerClientTransport transport)
 {
     lock (clients)
     {
         clients.Remove(transport);
         fireDisconnectedEvent(transport);
     }
 }