Skip to content

Commit

Permalink
Remove unused Num-Shards header
Browse files Browse the repository at this point in the history
  • Loading branch information
freyacodes committed Nov 28, 2020
1 parent 534834b commit 090a5d8
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 7 deletions.
1 change: 0 additions & 1 deletion IMPLEMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ the JDA client takes advantage of JDA's websocket write thread to send OP 4s for
When opening a websocket connection, you must supply 3 required headers:
```
Authorization: Password matching the server config
Num-Shards: Total number of shards your bot is operating on
User-Id: The user id of the bot you are playing music with
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class SocketServer(
) : TextWebSocketHandler() {

// userId <-> shardCount
private val shardCounts = ConcurrentHashMap<String, Int>()
val contextMap = ConcurrentHashMap<String, SocketContext>()
@Suppress("LeakingThis")
private val handlers = WebSocketHandlers(contextMap)
Expand All @@ -68,12 +67,9 @@ class SocketServer(
get() = contextMap.values

override fun afterConnectionEstablished(session: WebSocketSession) {
val shardCount = Integer.parseInt(session.handshakeHeaders.getFirst("Num-Shards")!!)
val userId = session.handshakeHeaders.getFirst("User-Id")!!
val resumeKey = session.handshakeHeaders.getFirst("Resume-Key")

shardCounts[userId] = shardCount

var resumable: SocketContext? = null
if (resumeKey != null) resumable = resumableSessions.remove(resumeKey)

Expand All @@ -84,8 +80,6 @@ class SocketServer(
return
}

shardCounts[userId] = shardCount

contextMap[session.id] = SocketContext(
audioPlayerManager,
serverConfig,
Expand Down

0 comments on commit 090a5d8

Please sign in to comment.