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