Skip to content

Commit

Permalink
Network: Pass log directly into SocketListener constructor.
Browse files Browse the repository at this point in the history
task: #12
  • Loading branch information
lewishazell committed May 23, 2021
1 parent 585c936 commit 9747851
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion cmpctircd/SocketListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public class SocketListener {
public int ServerCount = 0;
public int AuthServerCount = 0;

public SocketListener(IRCd ircd, SocketElement info) {
public SocketListener(Log log, IRCd ircd, SocketElement info) {
this.log = log ?? throw new ArgumentNullException(nameof(log));
this._ircd = ircd;
this.Info = info;
_listener = new TcpListener(info.Host, info.Port);
Expand Down
9 changes: 8 additions & 1 deletion cmpctircd/SocketListenerFactory.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
using cmpctircd.Configuration;
using System;

namespace cmpctircd {
public class SocketListenerFactory : ISocketListenerFactory {
private readonly Log log;

public SocketListenerFactory(Log log) {
this.log = log ?? throw new ArgumentNullException(nameof(log));
}

public SocketListener CreateSocketListener(IRCd ircd, SocketElement config) {
return new SocketListener(ircd, config);
return new SocketListener(log, ircd, config);
}
}
}

0 comments on commit 9747851

Please sign in to comment.