diff options
author | Determinant <[email protected]> | 2019-06-10 21:32:51 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2019-06-10 21:32:51 -0400 |
commit | 334fbbc9e4ed2131101062d8fbe1db4afae7c0aa (patch) | |
tree | 8f492ebe7c99e35bb2efcb125c71a388db9272ed | |
parent | d342de9e03902b93f1cff552e772f98caa0ee726 (diff) |
...
-rw-r--r-- | event.go | 8 | ||||
-rw-r--r-- | netaddr.go | 6 | ||||
-rw-r--r-- | network.go | 9 | ||||
m--------- | salticidae | 0 | ||||
-rw-r--r-- | stream.go | 2 |
5 files changed, 17 insertions, 8 deletions
@@ -27,13 +27,13 @@ func (self ThreadCall) GetEC() EventContext { return C.threadcall_get_ec(self) } type TimerEvent = *C.timerev_t type TimerEventCallback = C.timerev_callback_t -func NewTimerEvent(ec EventContext, cb TimerEventCallback) TimerEvent { - return C.timerev_new(ec, cb) +func NewTimerEvent(ec EventContext, cb TimerEventCallback, userdata rawptr_t) TimerEvent { + return C.timerev_new(ec, cb, userdata) } func (self TimerEvent) Free() { C.timerev_free(self) } -func (self TimerEvent) SetCallback(callback TimerEventCallback) { - C.timerev_set_callback(self, callback) +func (self TimerEvent) SetCallback(callback TimerEventCallback, userdata rawptr_t) { + C.timerev_set_callback(self, callback, userdata) } func (self TimerEvent) Add(t_sec float64) { C.timerev_add(self, C.double(t_sec)) } @@ -16,3 +16,9 @@ func NewAddrFromIPPortString(addr string) (res NetAddr) { func (self NetAddr) Free() { C.netaddr_free(self) } func (self NetAddr) IsEq(other NetAddr) bool { return bool(C.netaddr_is_eq(self, other)) } + +func (self NetAddr) IsNull() bool { return bool(C.netaddr_is_null(self)) } + +func (self NetAddr) GetIP() uint32 { return uint32(C.netaddr_get_ip(self)) } + +func (self NetAddr) GetPort() uint16 { return uint16(C.netaddr_get_port(self)) } @@ -44,16 +44,17 @@ func (self MsgNetwork) Start() { C.msgnetwork_start(self) } func (self MsgNetwork) SendMsg(msg Msg, conn MsgNetworkConn) { C.msgnetwork_send_msg(self, msg, conn) } func (self MsgNetwork) Connect(addr NetAddr) { C.msgnetwork_connect(self, addr) } +func (self MsgNetwork) Terminate(conn MsgNetworkConn) { C.msgnetwork_terminate(self, conn) } type MsgNetworkMsgCallback = C.msgnetwork_msg_callback_t type MsgNetworkConnCallback = C.msgnetwork_conn_callback_t -func (self MsgNetwork) RegHandler(opcode Opcode, callback MsgNetworkMsgCallback) { - C.msgnetwork_reg_handler(self, C._opcode_t(opcode), callback) +func (self MsgNetwork) RegHandler(opcode Opcode, callback MsgNetworkMsgCallback, userdata rawptr_t) { + C.msgnetwork_reg_handler(self, C._opcode_t(opcode), callback, userdata) } -func (self MsgNetwork) RegConnHandler(callback MsgNetworkConnCallback) { - C.msgnetwork_reg_conn_handler(self, callback) +func (self MsgNetwork) RegConnHandler(callback MsgNetworkConnCallback, userdata rawptr_t) { + C.msgnetwork_reg_conn_handler(self, callback, userdata) } type PeerNetwork = *C.struct_peernetwork_t diff --git a/salticidae b/salticidae -Subproject 66c711cf653b082ae07e1119417dcb3461039c8 +Subproject 299d1a3cf7f7ab2465dccc87dde578044c9b040 @@ -82,7 +82,9 @@ func (self UInt256) UInt256IsNull() bool { return bool(C.uint256_is_null(self)) func (self UInt256) UInt256IsEq(other UInt256) bool { return bool(C.uint256_is_eq(self, other)) } func (self UInt256) Serialize(s DataStream) { C.uint256_serialize(self, s) } func (self UInt256) Unserialize(s DataStream) { C.uint256_unserialize(self, s) } +func (self UInt256) IsEq(other UInt256) bool { return bool(C.uint256_is_eq(self, other)) } func (self DataStream) GetHash() UInt256 { return C.datastream_get_hash(self) } + |