diff --git a/libp2p/muxers/mplex/coder.nim b/libp2p/muxers/mplex/coder.nim index bbc8ba9..891e535 100644 --- a/libp2p/muxers/mplex/coder.nim +++ b/libp2p/muxers/mplex/coder.nim @@ -22,7 +22,7 @@ const DefaultChannelSize* = 1 shl 20 type Msg* = tuple - id: uint + id: uint64 msgType: MessageType data: seq[byte] @@ -61,10 +61,10 @@ proc readMsg*(conn: Connection): Future[Msg] {.async, gcsafe.} = trace "read data", data = data.len let header = headerVarint - result = (header shr 3, MessageType(header and 0x7), data) + result = (uint64(header shr 3), MessageType(header and 0x7), data) proc writeMsg*(conn: Connection, - id: uint, + id: uint64, msgType: MessageType, data: seq[byte] = @[]) {.async, gcsafe.} = trace "seding data over mplex", id, @@ -81,7 +81,7 @@ proc writeMsg*(conn: Connection, trace "unable to send message", exc = exc.msg proc writeMsg*(conn: Connection, - id: uint, + id: uint64, msgType: MessageType, data: string) {.async, gcsafe.} = result = conn.writeMsg(id, msgType, cast[seq[byte]](data)) diff --git a/libp2p/muxers/mplex/lpchannel.nim b/libp2p/muxers/mplex/lpchannel.nim index f0b0c00..4b0fe43 100644 --- a/libp2p/muxers/mplex/lpchannel.nim +++ b/libp2p/muxers/mplex/lpchannel.nim @@ -21,7 +21,7 @@ logScope: type LPChannel* = ref object of BufferStream - id*: uint + id*: uint64 name*: string conn*: Connection initiator*: bool @@ -35,7 +35,7 @@ type closeCode*: MessageType resetCode*: MessageType -proc newChannel*(id: uint, +proc newChannel*(id: uint64, conn: Connection, initiator: bool, name: string = "", diff --git a/libp2p/muxers/mplex/mplex.nim b/libp2p/muxers/mplex/mplex.nim index 0b7469e..dd801f2 100644 --- a/libp2p/muxers/mplex/mplex.nim +++ b/libp2p/muxers/mplex/mplex.nim @@ -28,12 +28,12 @@ const DefaultRWTimeout = InfiniteDuration type Mplex* = ref object of Muxer - remote*: Table[uint, LPChannel] - local*: Table[uint, LPChannel] - currentId*: uint - maxChannels*: uint + remote*: Table[uint64, LPChannel] + local*: Table[uint64, LPChannel] + currentId*: uint64 + maxChannels*: uint64 -proc getChannelList(m: Mplex, initiator: bool): var Table[uint, LPChannel] = +proc getChannelList(m: Mplex, initiator: bool): var Table[uint64, LPChannel] = if initiator: trace "picking local channels", initiator = initiator result = m.local @@ -43,7 +43,7 @@ proc getChannelList(m: Mplex, initiator: bool): var Table[uint, LPChannel] = proc newStreamInternal*(m: Mplex, initiator: bool = true, - chanId: uint = 0, + chanId: uint64 = 0, name: string = "", lazy: bool = false): Future[LPChannel] {.async, gcsafe.} = @@ -134,8 +134,8 @@ proc newMplex*(conn: Connection, new result result.connection = conn result.maxChannels = maxChanns - result.remote = initTable[uint, LPChannel]() - result.local = initTable[uint, LPChannel]() + result.remote = initTable[uint64, LPChannel]() + result.local = initTable[uint64, LPChannel]() let m = result conn.closeEvent.wait()