Skip to content

Commit

Permalink
Fixed coding style :P
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfowl committed Jul 31, 2011
1 parent 3f951ce commit 3b93a20
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
10 changes: 5 additions & 5 deletions SignalR/Hubs/HubContext.cs
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Principal;
using System.Web;

namespace SignalR.Hubs {
Expand All @@ -16,9 +13,12 @@ public class HubContext {
/// </summary>
public HttpCookieCollection Cookies { get; private set; }

public HubContext(string clientId, HttpCookieCollection cookies) {
public IPrincipal User { get; private set; }

public HubContext(string clientId, HttpCookieCollection cookies, IPrincipal user) {
ClientId = clientId;
Cookies = cookies;
User = user;
}
}
}
8 changes: 6 additions & 2 deletions SignalR/Hubs/HubDispatcher.cs
Expand Up @@ -8,6 +8,7 @@
using System.Web;
using System.Web.Script.Serialization;
using SignalR.Infrastructure;
using System.Security.Principal;

namespace SignalR.Hubs {
public class HubDispatcher : PersistentConnection {
Expand All @@ -25,6 +26,7 @@ public class HubDispatcher : PersistentConnection {
private readonly IJavaScriptProxyGenerator _proxyGenerator;
private readonly string _url;
private HttpCookieCollection _cookies;
private IPrincipal _user;

public HubDispatcher(string url)
: this(DependencyResolver.Resolve<IHubFactory>(),
Expand Down Expand Up @@ -71,7 +73,7 @@ public HubDispatcher(string url)
string hubName = hub.GetType().FullName;

var state = new TrackingDictionary(hubRequest.State);
hub.Context = new HubContext(clientId, _cookies);
hub.Context = new HubContext(clientId, _cookies, _user);
hub.Caller = new SignalAgent(Connection, clientId, hubName, state);
var agent = new ClientAgent(Connection, hubName);
hub.Agent = agent;
Expand Down Expand Up @@ -124,7 +126,7 @@ public HubDispatcher(string url)
}
}
catch (TargetInvocationException e) {
ProcessResult(state, null, hubRequest, e.GetBaseException());
ProcessResult(state, null, hubRequest, e);
}

return base.OnReceivedAsync(clientId, data);
Expand All @@ -139,6 +141,8 @@ public HubDispatcher(string url)
}

_cookies = context.Request.Cookies;
_user = context.User;

return base.ProcessRequestAsync(context);
}

Expand Down
7 changes: 3 additions & 4 deletions SignalR/Hubs/HubMethodNameAttribute.cs
Expand Up @@ -3,17 +3,16 @@
namespace SignalR.Hubs {
[AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
public sealed class HubMethodNameAttribute : Attribute {
private readonly string methodName;

public HubMethodNameAttribute(string methodName) {
if (String.IsNullOrEmpty(methodName)) {
throw new ArgumentNullException("methodName");
}
this.methodName = methodName;
MethodName = methodName;
}

public string MethodName {
get { return methodName; }
get;
private set;
}
}
}
9 changes: 4 additions & 5 deletions SignalR/Hubs/HubNameAttribute.cs
Expand Up @@ -2,18 +2,17 @@

namespace SignalR.Hubs {
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
public sealed class HubNameAttribute : Attribute {
private readonly string hubName;

public sealed class HubNameAttribute : Attribute {
public HubNameAttribute(string hubName) {
if (String.IsNullOrEmpty(hubName)) {
throw new ArgumentNullException("hubName");
}
this.hubName = hubName;
HubName = hubName;
}

public string HubName {
get { return hubName; }
get;
private set;
}
}
}

0 comments on commit 3b93a20

Please sign in to comment.